String/Number Conversion

Wojtek Walczak gminick at bzt.bzt
Sat Sep 6 17:29:46 EDT 2008


On Sat, 06 Sep 2008 23:04:14 +0200, Andreas Hofmann wrote:

Hi,

> I've got a little problem here, which which really creeps me out at the 
> moment.
> I've got some strings, which only contain numbers plus eventually one 
> character as si-postfix (k for kilo, m for mega, g for giga). I'm trying 
> to convert those strings to integers, with this function:

>                  if mult is 1:
                           ^^
You're testing for identity, not for equality.
Change it to "if mult == 1". Is it alright now?


-- 
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/



More information about the Python-list mailing list