Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-28 Thread Kam-Hung Soh
Matthias Bläsing wrote: Am Wed, 28 May 2008 10:41:51 -0700 schrieb davidj411: I like the str2num function approach, but then i get left with a float that has more than 2 decimal spaces , i.e. 11.50 becomes 11.449 and round will not fix that. Welcome to the wonderful world of float

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-28 Thread Matthias Bläsing
Am Wed, 28 May 2008 10:41:51 -0700 schrieb davidj411: > I like the str2num function approach, but then i get left with a float > that has more than 2 decimal spaces , i.e. 11.50 becomes > 11.449 and round will not fix that. Welcome to the wonderful world of floating point numbers. For

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-28 Thread davidj411
On May 28, 2:22 am, Kam-Hung Soh <[EMAIL PROTECTED]> wrote: > David Jackson wrote: > > i used the csv module and saved its contents to a list. > > > ['Date', 'No.', 'Description', 'Debit', 'Credit'] > > ['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45'] > > ['3/04/2007', '5678', 'THE HOME DEP

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-27 Thread Kam-Hung Soh
David Jackson wrote: i used the csv module and saved its contents to a list. ['Date', 'No.', 'Description', 'Debit', 'Credit'] ['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45'] ['3/04/2007', '5678', 'THE HOME DEPOT 263 SomeCity FL', '', '25.40'] the credit/debit fields are strings. what

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-05-27 Thread Gabriel Genellina
En Tue, 27 May 2008 13:00:05 -0300, David Jackson <[EMAIL PROTECTED]> escribió: i used the csv module and saved its contents to a list. ['Date', 'No.', 'Description', 'Debit', 'Credit'] ['3/17/2006', '5678', 'ELECTRONIC PAYMENT', '', '11.45'] ['3/04/2007', '5678', 'THE HOME DEPOT 263 SomeCity

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread George Sakkis
On Feb 28, 5:56 pm, davidj411 <[EMAIL PROTECTED]> wrote: > i am parsing a cell phone bill to get a list of all numbers and the > total talktime spend on each number. > > (snipped) > > I actually found a good solution. > (snipped) If you post 1-2 samples of the cell phone bill input, I am sure you

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread D'Arcy J.M. Cain
On Fri, 29 Feb 2008 13:32:15 -0800 (PST) "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > You have to get rid of the double quotes first. > > you mean replace them with nothing? > > li[4].replace('"','') Sure, that will do. However, look at the csv module for another way of handling this.

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread Terry Reedy
"davidj411" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |i am parsing a cell phone bill to get a list of all numbers and the | total talktime spend on each number. | | i already have a unique list of the phone numbers. | now i must go through the list of numbers and add up the tot

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-29 Thread [EMAIL PROTECTED]
> You have to get rid of the double quotes first. you mean replace them with nothing? li[4].replace('"','') once i do that, i should be able to use them as numbers. -- http://mail.python.org/mailman/listinfo/python-list

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-28 Thread Larry Bates
davidj411 wrote: > i am parsing a cell phone bill to get a list of all numbers and the > total talktime spend on each number. > > i already have a unique list of the phone numbers. > now i must go through the list of numbers and add up the totals for > each number. > on the bill, each line has a f

Re: convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-28 Thread D'Arcy J.M. Cain
On Thu, 28 Feb 2008 14:56:10 -0800 (PST) davidj411 <[EMAIL PROTECTED]> wrote: > ValueError: invalid literal for int() with base 10: '"2"' > > > here is the question: > > How can i convert a string number like "2" to a true number that can > be added. You have to get rid of the double quotes fir

convert string number to real number - ValueError: invalid literal for int() with base 10: '"2"'

2008-02-28 Thread davidj411
i am parsing a cell phone bill to get a list of all numbers and the total talktime spend on each number. i already have a unique list of the phone numbers. now i must go through the list of numbers and add up the totals for each number. on the bill, each line has a few fields,one field containing