我在这里先向您的帮助表示感谢。我很困惑相同的代码适用于 python 2.6 但不适用于 2.5。这是代码
import cgi, urllib, urlparse, urllib2
url='https://graph.facebook.com'
req=urllib2.Request(url=url)
p=urllib2.urlopen(req)
response = cgi.parse_qs(p.read())
这是我得到的例外
Traceback (most recent call last):
File "t2.py", line 6, in <module>
p=urllib2.urlopen(req)
File "/home/userx/lib/python2.5/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/home/userx/lib/python2.5/urllib2.py", line 381, in open
response = self._open(req, data)
File "/home/userx/lib/python2.5/urllib2.py", line 404, in _open
'unknown_open', req)
File "/home/userx/lib/python2.5/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/home/userx/lib/python2.5/urllib2.py", line 1140, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib2.URLError: <urlopen error unknown url type: https>
再次感谢您的帮助。