python2中的unicode()函數在python3中會報錯:NameError: name 'unicode' is not defined
There is no such name in Python 3, no. You are trying to run Python 2 code in Python 3. In Python 3, unicode has been renamed to str.
翻譯過來就是:Python 3中沒有這樣的名字,沒有。 您正在嘗試在Python 3中運行Python 2代碼。在Python 3中,unicode已重命名為str。
函數轉換:unicode()到 str()為:
//python2: unicode(nn,'utf-8') //python3: str(nn)