解决网页采集编码正确还是报错的问题

      发布在:Python技术      评论:0 条评论
url = 'https://pic.netbian.com/tupian/24072.html'
res = requests.get(url=url)
if '<meta charset="gbk"' in str(res):
cont = res.decode('gbk',errors='ignore')
else:
cont = res.decode('gb18030',errors='ignore')


相关文章
热门推荐