Andreas Hofmann wrote:
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:
Why bother to always switch the case if you only use a few values?
Als
Thanks a lot, I got it working now.
Thanks also to the other guys, your numerous hints were really valuable!
Kind regards,
Andy
John Machin schrieb:
On Sep 7, 7:04 am, Andreas Hofmann <[EMAIL PROTECTED]>
wrote:
Hello Folks!
I've got a little problem here, which which really creeps me out at t
Andreas Hofmann, there are several problems in your code:
> if type(value) is str:
Better to use isinstance() and to compare it with basestring instead.
> value.upper()
This does nothing, python strings are immutable, so they don't get
changed in-place, so you have to
On Sep 7, 7:29 am, Wojtek Walczak <[EMAIL PROTECTED]> wrote:
> On Sat, 06 Sep 2008 23:04:14 +0200, Andreas Hofmann wrote:
> > if mult is 1:
>
> ^^
> You're testing for identity, not for equality.
> Change it to "if mult == 1". Is it alright now?
>
Althou
On Sep 7, 7:04 am, Andreas Hofmann <[EMAIL PROTECTED]>
wrote:
> Hello Folks!
>
> 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).
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
On Sep 6, 5:04 pm, Andreas Hofmann <[EMAIL PROTECTED]>
wrote:
> Hello Folks!
>
> 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).
Hello Folks!
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: