On Tue, Oct 7, 2008 at 11:58 AM, Daniele Varrazzo <[EMAIL PROTECTED]> wrote:
> No, non lo รจ. Io di solito aggiro la cosa con:
>
> In [1]: s = "20,90"
>
> In [2]: print float(s.replace(",", "."))
> 20.9

Occhio che gli ammerregani usano la virgola per separare gruppi di cifre:

>>> s = "10,239.59"
>>> print float(s.replace(",","."))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for float(): 10.239.59
-- 
http://antoniocangiano.com - Zen and the Art of Programming
http://math-blog.com - Mathematics is wonderful!
http://stacktrace.it - Aperiodico di resistenza informatica
Currently writing "Ruby on Rails for Microsoft Developers" for Wrox.
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a