str(), unicode() and isinstance : isinstance « Buildin Function « Python Tutorial






print isinstance(u'\0xAB', str)
print not isinstance('foo', unicode)
print isinstance(u'', basestring)
print not isinstance('foo', basestring)








13.27.isinstance
13.27.1.Checking the Type
13.27.2.str(), unicode() and isinstance