Traceback (most recent call last):
File "F:/爬虫/llll.py", line 12, in <module>
resp = urlopen("https;//en.wikipedia.org/wiki/Main_Page").read().decode("utf-8")
File "C:\Users\微软中国\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\微软中国\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 511, in open
req = Request(fullurl, data)
File "C:\Users\微软中国\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 329, in __init__
self.full_url = url
File "C:\Users\微软中国\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 355, in full_url
self._parse()
File "C:\Users\微软中国\AppData\Local\Programs\Python\Python36-32\lib\urllib\request.py", line 384, in _parse
raise ValueError("unknown url type: %r" % self.full_url)
ValueError: unknown url type: 'https;//en.wikipedia.org/wiki/Main_Page'
"https;//en.wikipedia.org/wiki/Main_Page"
突然发现你的网址https后面跟着是分号;
应该改为:冒号
resp = urllib.urlopen("https;//en.wikipedia.org/wiki/Main_Page").read().decode("utf-8")
或者是
resp = urllib2.urlopen("https;//en.wikipedia.org/wiki/Main_Page").read().decode("utf-8")
不知道这样对吗