type
type 只是判断这个类型。
1 | >>>lst = [1, 2, 3] |
ininstance
isinstance 可以判断是不是已知的类型,
1 | isinstance(object, class-or-type-or-tuple) -> bool |
参数二为一个元组,则若对象类型与元组中类型名之一相同即返回True.
1 | >>>isinstance(lst, list) |
type 只是判断这个类型。
1 | >>>lst = [1, 2, 3] |
isinstance 可以判断是不是已知的类型,
1 | isinstance(object, class-or-type-or-tuple) -> bool |
参数二为一个元组,则若对象类型与元组中类型名之一相同即返回True.
1 | >>>isinstance(lst, list) |