变量

判断变量类型

优先用isinstance,而不是type

>>> isinstance(2, float)
False
>>> isinstance('a', (str, unicode))
True
>>> isinstance((2, 3), (str, list, tuple))
True

results matching ""

    No results matching ""