在语句中目标名字要和定义的一样

 

 

>>> range(10)
range(0, 10)
>>> for i in range:
print(i)


Traceback (most recent call last):
File "<pyshell#47>", line 1, in <module>
for i in range:
TypeError: 'type' object is not iterable
>>> for i in range(10):
print(i)


0
1
2
3
4
5
6
7
8
9