这很简单,我无法弄清楚。这是代码:
def combine(h0, gyro, vx, bias, len=400.0):
for i in range(len(gyro)):
print i
a = combine(3.0, [0.1, 0.2,0.3], [0.1, 0.2,0.3], 0.1)
这给了我一个错误:
File "indoor.py", line 84, in a = combine(3.0, [0.1, 0.2,0.3], [0.1, 0.2,0.3], 0.1) File "indoor.py", line 28, in combine for i in range(len(gyro)): TypeError: 'float' object is not callable
我猜它会变得非常简单,但我无法看到错误!
答案 0 :(得分:6)
您已将len分配给float len=400.0
,因此len
不再引用python函数,只需重命名参数。
def combine(h0, gyro, vx, bias, ln=400.0):
for i in range(len(gyro)):
print i