爬虫项目报错Traceback (most recent call last): File "D:/studay/python/one/day01/07_post请求.py", line 38,

报错:

Traceback (most recent call last):
  File "D:/studay/python/one/day01/07_post请求.py", line 38, in <module>
    print(response.read().decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 172: invalid continuation byte

解决方法:
在decode()内加入gbk
如下

response.read().decode(‘gbk’)

你可能感兴趣的:(python)