Python3.9中,使用from collections import Iterable报错
刚开始学习python,用的是3.9的版本,使用 isinstance(‘abc’, Iterable) 命令,来判断对象是否是可迭代对象,教程中说引入from collections import Iterable。但是这样会报如下错误:
DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
from collections import Iterable
然后改了下引入的内容为from collections.abc import Iterable就好了,应该是新版本没有支持上述方式的引入吧。