How can I check if a Python object is a string (either regular or Unicode)?
Use isinstance(obj, basestring) for an object-to-test obj.
isinstance(obj, basestring)
obj
Docs.
1.4m articles
1.4m replys
5 comments
57.0k users