Python新手,但我正在尝试...从站点检索数据:
import urllib.request
response = urllib.request.urlopen("http://www.python.org")
这是我在 Python 3.1 文档中看到的相同代码。还有很多网站。
但是,我得到:
Message File Name Line Position
Traceback
<module> G:\My Documents\Python\HTTP.py 14
urlopen E:\Python 3.1\Lib\urllib\request.py 119
open E:\Python 3.1\Lib\urllib\request.py 342
_open E:\Python 3.1\Lib\urllib\request.py 360
_call_chain E:\Python 3.1\Lib\urllib\request.py 320
http_open E:\Python 3.1\Lib\urllib\request.py 1063
do_open E:\Python 3.1\Lib\urllib\request.py 1048
URLError: <urlopen error [Errno 10022] An invalid argument was supplied>
我不知道是什么原因造成的。有人知道吗?