How to find out if a Python object is a string?

Python 2

Use isinstance(obj, basestring) for an object-to-test obj.

Docs.

Leave a Comment