刚开始学习爬虫,但遇到一个麻烦,看着视频教的程序,一个一个敲出的,他为什么可以运行,我就不能运行,希望得到高手的帮助.
from urllib import request
url=r"http://www.baidu.com/"
deponse=request.urlopen(url).read().decode()
print(deponse)
错误提示:
Traceback (most recent call last):
File “G:\python123\pi_digits_read.py”, line 4, in
deponse=request.urlopen(url).read().decode()
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x8b in position 1: invalid start byte
[Finished in 1.0s with exit code 1]
[shell_cmd: python -u “G:\python123\pi_digits_read.py”]
[dir: G:\python123]
[path: C:\Python\Python37\Scripts;C:\Python\Python37;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Python\Python37\Scripts;C:\Python\Python37;.;;.;]