照搬的代码,输出后是这样
第一种方法
Traceback (most recent call last):
File "c:\Users\Administrator\Desktop\text\test.urlliber.py", line 5, in <module>
responsel=urllib2.urlopen(url)
File "C:\python27\lib\urllib2.py", line 127, in urlopen
return _opener.open(url, data, timeout)
File "C:\python27\lib\urllib2.py", line 402, in open
req = meth(req)
File "C:\python27\lib\urllib2.py", line 1113, in do_request_
raise URLError('no host given')
URLError: <urlopen error no host given>