0 votes
1 view
in Python by (27.5k points)

How can I check if a Python object is a string (either regular or Unicode)?

1 Answer

0 votes
by (67.1k points)

There are many ways to find out that a Python statement is a string:-

The first thing you can use isinstance(obj, basestring) for an object-to-test for a string.

Another way you can use is type(o) it will also tell you that the Python object is a string.