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