I\'m aware that I can use: isinstance(x, str) in python-3.x but I need to check if something is a string in python-2.x as well. Will isinstance(x, str)
isinstance(x, str)
What about this, works in all cases?
isinstance(x, ("".__class__, u"".__class__))