ValueError: could not convert string to float: '1,000.00'
看图片最后一行的报错信息,金额中间有千分符逗号,那是展示出来方便看的。要去掉才能转为数值。
>>> str='1,000.00' >>> str=str.replace(",", "") >>> amount=float(str) >>> print(amount) 1000.0