Very basic but I can't think what I'm doing wrong so hoping maybe it's a syntax change I'm not yet aware of. This line:
if isinstance(x, list):
Throws this error:
TypeError: isinstance() arg 2 must be a type or tuple of types
So why isinstance() not recognising list as a type?
You probably overwritten list
somewhere in your program:
>>> isinstance("", list)
False
>>> list = 123
>>> isinstance("", list)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: isinstance() arg 2 must be a type or tuple of types
>>>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.