方法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
python判断类型
原文:http://www.cnblogs.com/kaituorensheng/p/5086151.html