Re: newbie question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Manuel Ebert

    Re: newbie question

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

    Hi sharon,

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

    number = int(fetched_num ber.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)

    iD8DBQFIssKJcZ7 0OCIgLecRAkxTAJ 4wWKxmlAS8hdQZK 0Eoj7pAxwx41wCa A/eI
    NY9GZKX6+PNIYIG aaghNvZg=
    =JN2/
    -----END PGP SIGNATURE-----
Working...