问答详情
源自:4-1 存储数据到MySQL

mysql输出问题


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'


提问者:yourgod 2017-07-19 14:32

个回答

  • lwzhuo
    2017-07-19 19:30:56
    已采纳

    "https;//en.wikipedia.org/wiki/Main_Page"

    突然发现你的网址https后面跟着是分号;

    应该改为:冒号

  • lwzhuo
    2017-07-19 19:29:22

    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")

    不知道这样对吗