[Tutor] Help converting strings to numbers

dman dsh8290@rit.edu
Tue, 28 Aug 2001 11:13:19 -0400


On Tue, Aug 28, 2001 at 11:36:25AM +0200, Charlie Clark wrote:
| Dear all,
| 
| I'm getting a whole set of values and putting them in a dictionary like 
| this
| 
| {'preis': '2.029,00', 'marktpreis':'3.399,00'}

You Europeans just can't do anything right, can you <wink>?

It would certainly be useful if someone wrote a Euro<=>US literal
float converter and if the float() function could handle both
notations.  The easiest is probably just to mangle the string to match
the US notation and then use float() to convert (or strip the decimal
point and use int()).

-D