学习python使用rabbitmq,遇到麻烦
巴扎黑
巴扎黑 2017-04-17 13:51:29
0
2
405
巴扎黑
巴扎黑

全部回覆(2)
刘奇

if not isinstance(host, basestring):

NameError: global name 'basestring' is not defined

說明basestring 不存在, 你需要import 進來或定義這個變數
如 a="test"
if not isinstance(a, str): #str 是類型的類型, 所以不用導入, 如果不是就需要導入這個類別或方法
print "不是字串型別"
else:
print "這個是字串型別"

Ty80

python3 裡已經沒有basestring 類型了,你可以做轉換啊。請參考這個http://woodpecker.org.cn/peintopython3/porting-code-to-python-3-with-2to3.html

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!