更新时间:2023-11-29 09:25:16
仅在 python 2(不是 python 3)中:
In python 2 only (not python 3):
assert not isinstance(lst, basestring)
实际上就是你想要的,否则你会错过很多类似于列表但不是list
或tuple
的子类的东西.
Is actually what you want, otherwise you'll miss out on a lot of things which act like lists, but aren't subclasses of list
or tuple
.