我按照教程:无法判断迭代在Python
在我PyCharm我按照教程:
我得到的错误:
Traceback (most recent call last): File "/Users/adob/TestPython/test02/passwd.py", line 19, in bool = isinstance({}, Iterable) NameError: name 'Iterable' is not defined
我按照教程:无法判断迭代在Python
在我PyCharm我按照教程:
我得到的错误:
Traceback (most recent call last): File "/Users/adob/TestPython/test02/passwd.py", line 19, in bool = isinstance({}, Iterable) NameError: name 'Iterable' is not defined
from collections import Iterable
bool = isinstance({},Iterable)
print(bool)
输出
真
Iterable在collections
模块,你应该导入它。
from collections import Iterable
在Py3中,另一个选项与'typing'模块的输入相同,但给定'print'语句假定OP使用Py2。 – AChampion
你不应该使用的图像时,可以使用文本 –
@AzatIbrakov我用的形象,因为有在网上红在这里。使用代码无法显示它。 – 244boy