方法1:
from collections import Iterable isinstance('abc', Iterable) # str是否可迭代
方法2:
alst = [1, 2] hasattr(alst, '__iter__')