python3爬虫爬百度贴吧decode("utf-8")出错 5
爬百度贴吧显示UnicodeEncodeError:'UCS-2'codeccan'tencodecharactersinposition95209-95209:Non-...
爬百度贴吧显示UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 95209-95209: Non-BMP character not supported in Tk,应该不是语法的错,换成爬百度首页就没显示错,删了decode("utf-8")也不会错,不过删了爬下的编码就乱了
展开
展开全部
我写了下代码。没有编码问题,是不是不用decode?
import requests
r1 = requests.get("http://tieba.baidu.com/f?ie=utf-8&kw=python&fr=search")
print(r1.text)
import requests
r1 = requests.get("http://tieba.baidu.com/f?ie=utf-8&kw=python&fr=search")
print(r1.text)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询