- 论坛徽章:
- 0
|
我用下面一段话想打开一个网页,但是总是报错,程序如下:
import urllib
sock = urllib.urlopen("http://www.sina.com/")
报错为:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
sock = urllib.urlopen("http://www.sina.com/")
File "C:\Python25\lib\urllib.py", line 82, in urlopen
return opener.open(url)
File "C:\Python25\lib\urllib.py", line 190, in open
return getattr(self, name)(url)
File "C:\Python25\lib\urllib.py", line 325, in open_http
h.endheaders()
File "C:\Python25\lib\httplib.py", line 856, in endheaders
self._send_output()
File "C:\Python25\lib\httplib.py", line 728, in _send_output
self.send(msg)
File "C:\Python25\lib\httplib.py", line 695, in send
self.connect()
File "C:\Python25\lib\httplib.py", line 679, in connect
raise socket.error, msg
IOError: [Errno socket error] (10061, 'Connection refused')
请问高手这是什么问题啊!!!! |
|