How to find out if a Python object is a string? September 14, 2022 by Tarik Python 2 Use isinstance(obj, basestring) for an object-to-test obj. Docs.