python判断类型
方法
isinstance(obj, type)
示例
>>> print isinstance(3, int) True >>> print isinstance(3, str) False >>> print isinstance(3, list) False >>> print isinstance([1,2,3], list) True
isinstance(obj, type)
>>> print isinstance(3, int) True >>> print isinstance(3, str) False >>> print isinstance(3, list) False >>> print isinstance([1,2,3], list) True