亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

python爬蟲打印HTML問題

python爬蟲打印HTML問題

一只甜甜圈 2018-10-03 21:17:15
import urllib.requestimport urllib.parsepage = 1url = "http://www.qiushibaike.com/8hr/page/" + str(page)headers = {"User-Agent": "Mozilla/5.0 (Linux; Android 6.0;  Nexus 5 Build/MRA58N)"}request = urllib.request.Request(url, headers=headers)response = urllib.request.urlopen(request).read()html = response.decode("utf-8")print(html)運行后就報錯誤:UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 18194-18195: invalid continuation byte把'utf-8'改成'GBK'也不行一樣報錯,這個要怎么解決?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 1654 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號