type()和isinsten()之间有什么区别?
type()
:
import typesif type(a) is types.DictType: do_something()if type(b) in types.StringTypes: do_something_else()
isinstance()
:
if isinstance(a, dict): do_something()if isinstance(b, str) or isinstance(b, unicode): do_something_else()
肥皂起泡泡
相关分类