Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43579

Re: howto remove the thousand separator

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: howto remove the thousand separator
Date 2013-04-14 20:29 +0100
References <201304150257331336590@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.600.1365967712.3114.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: howto remove the thousand separator Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-04-14 20:29 +0100

csiph-web