您的数字中不能有多个点(.
)或逗号(,
),因为这两个符号用于
atof()将数字的小数部分与整数部分分开。
由于Python不需要点即可正确表示您的数字,因此应删除它们并仅保留逗号:
import localefrom locale import atoflocale.setlocale(locale.LC_ALL, 'de_DE')string_nb = '17.907,08'string_nb = string_nb.replace('.', '')number = atof(string)


