python: 关于解决'\u'开头的字符串转中文的方法

转自
https://www.cnblogs.com/hahaxzy9500/p/7685955.html

爬虫爬到的内容是这样的:

在这里插入图片描述

如果直接打印出来是这样的:

python3的解决办法:字符串.encode('utf-8').decode('unicode_escape')

python2:字符串.decode('unicode_escape')

猜你喜欢

转载自blog.csdn.net/L1558198727/article/details/86568081