Python isinstance

Decide if an instance is the given object
isinstance(object, classinfo)

1 if ((isinstance(data, str) or isinstance(data, unicode)) and data.strip().startswith('<')):
2         result = True

 

classinfo can be:
Sequence Types — str, unicode, list, tuple, bytearray, buffer, xrange
Numeric Types — int, float, long, complex

isinstance('1', str)

the result is True

posted on 2013-08-03 17:30  JasonKwok  阅读(249)  评论(0)    收藏  举报

导航