<分区> 分区>
在 Python 3.5 中,我想使用带有以下代码的 locale.atof 将德语数字字符串转换为 float :
import locale
from locale import atof
locale.setlocale(locale.LC_ALL, 'de_DE')
number = atof('17.907,08')
然而,这引发了一个ValueError:
ValueError: could not convert string to float: '17.907.08'
为什么?这不正是
atof() 的用途吗?
