from urllib.request import urlopen
url = '
response =urlopen(url)
info = response.read()
print(info)
运行时,出现如下错误,是什么原因?
/Users/kola/Downloads/python百战课程/1/venv/bin/python /Users/kola/Downloads/python百战课程/1/pachong.py
Traceback (most recent call last):
File "/Users/kola/Downloads/python百战课程/1/pachong.py", line 4, in <module>
response=urlopen(url)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 522, in open
req = meth(req)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py", line 1274, in do_request_
raise URLError('no host given')
urllib.error.URLError: <urlopen error no host given>
Process finished with exit code 1