How can I check if a Python object is a string (either regular or Unicode)?
Its simple, use the following code (we assume the object mentioned to be obj)-
if type(obj) == str: print('It is a string') else: print('It is not a string.')