NameError: global name 'basestring' is not defined
Indicates that basestring does not exist, you need to import it or define this variable
Such as a="test"
if not isinstance(a, str): #str is the type of type, so there is no need to import it. If not, you need to import this class or method
print "Not a string type"
else:
print "This is a string type"
There is no basestring type in python3, you can convert it. Please refer to this http://woodpecker.org.cn/peintopython3/porting-code-to-python-3-with-2to3.html
if not isinstance(host, basestring):
NameError: global name 'basestring' is not defined
Indicates that basestring does not exist, you need to import it or define this variable
Such as a="test"
if not isinstance(a, str): #str is the type of type, so there is no need to import it. If not, you need to import this class or method
print "Not a string type"
else:
print "This is a string type"
There is no basestring type in python3, you can convert it. Please refer to this http://woodpecker.org.cn/peintopython3/porting-code-to-python-3-with-2to3.html