使用atof转换数字
发布于 2021-01-29 16:39:13
在中Python 3.5
,我想使用locale.atof
以下代码将德语数字字符串转换为浮点数:
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()
为了什么吗?
关注者
0
被浏览
51
1 个回答