Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

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

1 Answer

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

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer

Browse Categories

...