列表和迭代器
列表和迭代器的区别
实例:
li =[1,2,3,4,5] for i in li.__iter__(): print(i) # print(li.__iter__()) print('#######################################') # a =li.__iter__() print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__())) print(next(li.__iter__()))
运行结果后面都是 1