Wetts's blog

Stay Hungry, Stay Foolish.

0%

Python中Iterable对象

参考:https://blog.csdn.net/slrong/article/details/80306905

Python 中判断对象是否能迭代,导入 from collections import Iterable 报错。

改为 from collections.abc import Iterable 就可以了。

1
2
3
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
from collections import Iterable
True