学习迭代器引用
from collections import Iterable
ImportError: cannot import name 'Iterable' from 'collections' (C:\Users\alien\AppData\Local\Programs\Python\Python310\lib\collections_init_.py)
试着在setting 中把collections 、Iterable都重新载入了,一直报错这个。
正常使用迭代器
collections里没有这个模块或函数
x = iter([6, 2, 3, ])
print(next(x))
print(next(x))
print(next(x))
print(next(x))
'''--result
6
2
3
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\PyTest\test13.py", line 12, in <module>
print(next(x))
StopIteration
Process terminated with an exit code of 1
'''