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)

  


 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM