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


Groups > comp.lang.python > #43579 > unrolled thread

Re: howto remove the thousand separator

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2013-04-14 20:29 +0100
Last post2013-04-14 20:29 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#43579 — Re: howto remove the thousand separator

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-04-14 20:29 +0100
SubjectRe: howto remove the thousand separator
Message-ID<mailman.600.1365967712.3114.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web