for i in column1: x = int(i) s += x print "sum:",s,"count:",len(column1) # round (s / len(column1), 3) print "avg",round (s / len(column1), 3)
Traceback (most recent call last):
File "C:/3/csv测试.py", line 26, in <module> x = int(i)ValueError: invalid literal for int() with base 10: '18.4'
这里的错误在于用了int 应该用float