from collections.abc import Iterable
isinstance([11,22,33,44],Iterable)
out: True
调用上述函数返回bool类型值
如果还要查看一个python是否为一个迭代器,代码为:
from collections.abc import Iterator
isinstance([11,22,33,44],Iterator)
out: True
from collections.abc import Iterable
isinstance([11,22,33,44],Iterable)
out: True
调用上述函数返回bool类型值
如果还要查看一个python是否为一个迭代器,代码为:
from collections.abc import Iterator
isinstance([11,22,33,44],Iterator)
out: True