typeError: isinstance() arg 2 must be a type or tuple of types >>>

后端 未结 3 1033
孤街浪徒
孤街浪徒 2021-01-01 14:19
>>> names=[\'jill\',\'jack\']
>>> isinstance(names,list)
Traceback (most recent call last):
  File \"\", line 1, in 

        
相关标签:
3条回答
  • 2021-01-01 15:03

    Apply this one :

    if isinstance(names, type(list)):
    
    0 讨论(0)
  • 2021-01-01 15:09

    But this works in Python (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32:

    >>> names=['jill', 'jack']
    >>> isinstance(names, list)
    True
    
    0 讨论(0)
  • 2021-01-01 15:11

    You've stomped on list by assigning to a local variable of the same name. Don't do that.

    0 讨论(0)
提交回复
热议问题