search

Home  >  Q&A  >  body text

学习python使用rabbitmq,遇到麻烦

巴扎黑巴扎黑2767 days ago444

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-17 13:53:29

    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"

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:53:29

    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

    reply
    0
  • Cancelreply