newbie question

Manuel Ebert maebert at uos.de
Mon Aug 25 10:32:41 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi sharon,

as I understand, you want to remove certain characters of a string. Try:

number = int(fetched_number.replace(',', ''))

this will first remove any , characters and then convert the string  
into an integer.

Best,
Manuel

On Aug 25, 2008, at 4:15 PM, sharon k wrote:

> hi all,
>
> i am new to python.
>
> i fetch a webpage with urllib, extract a few numbers in a format as  
> follow;
>
> 10,884
> 24,068
>
> my question is how to remove the comma between the number, since i  
> have to add them up later.
>
> sorry for my bad english.
> --
> http://mail.python.org/mailman/listinfo/python-list

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFIssKJcZ70OCIgLecRAkxTAJ4wWKxmlAS8hdQZK0Eoj7pAxwx41wCaA/eI
NY9GZKX6+PNIYIGaaghNvZg=
=JN2/
-----END PGP SIGNATURE-----



More information about the Python-list mailing list