1.urllib.request的时候加入header,报错”UnicodeDecodeError: 'utf8' codec can't decode byte 0x8b in position 1: invalid start byte“
检查header中是否在Accept-Encoding中加入gzip, deflate,有的话就去掉。网页传输数据的时候使用gzip的方式压缩传递,deflate算法处理,而python爬虫不需要。
headers = {'Accept-Encoding': 'gzip, deflate'}