How to check if an object is a string in Python

An object is a string if it has the type str.

Solution for How to check if an object is a string in Python : You can use isinstance() to check if an object is a string Call isinstance(object, class) with an object as object and str as class.

print(a_number)


how-to-check-if-an-object-is-a-string-in-python