use `isinstance(x, basestring)` to check string type