Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'string': 0.09; "'')": 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; "','": 0.16; 'comma': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'separator,': 0.16; 'subject:howto': 0.16; 'subject:remove': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'url:moin': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'url:wiki': 0.31; 'url:python': 0.33; 'subject:the': 0.34; 'problem': 0.35; 'method': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'remove': 0.60; 'read': 0.60; "you're": 0.61; 'such': 0.63; 'charset:windows-1252': 0.65; 'reply': 0.66 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: howto remove the thousand separator Date: Sun, 14 Apr 2013 20:29:13 +0100 References: <201304150257331336590@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-92-18-43-197.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: <201304150257331336590@gmail.com> X-Antivirus: avast! (VPS 130414-0, 14/04/2013), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365967712 news.xs4all.nl 2571 [2001:888:2000:d::a6]:59166 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43579 On 14/04/2013 19:57, pyth0n3r wrote: > Hi, > I came across a problem that when i deal with int data with ',' as > thousand separator, such as 12,916, i can not change it into int() or > float(). > How can i remove the comma in int data? > Any reply will be appreciated!! > Best, > Chen > > Use the string replace method thus. >>> '12,916'.replace(',', '') '12916' -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence