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

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

1 Answer

0 votes
by (30.4k 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.

...