python2中的unicode()函数在python3中会报错:

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)

  


 

posted @ 2019-07-06 21:07  哦摩西罗伊  阅读(16892)  评论(0编辑  收藏  举报