[Tutor] Help converting strings to numbers

Charlie Clark Charlie@begeistert.org
Tue, 28 Aug 2001 12:12:50 +0200


>Not sure if there is a function for this in the standard library, but 
you can  
>easily roll your own: 
> 
>>>> import string 
>>>> s = '2.029,33' 
>>>> s = string.replace(s, ".", "") 
>>>> s 
>'2029,33' 
>>>> s = string.replace(s, ",", ".") 
>>>> s 
>'2029.33' 
oh, okay. Not elegant but functional and seeing as what I'm doing is 
insane anyway that will do fine