mysql输出问题

来源:4-1 存储数据到MySQL

yourgod

2017-07-19 14:32


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'


写回答 关注

2回答

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

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

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

    应该改为:冒号

    yourgo...

    是的,后来复制网址的时候才发现这个符号错了。十分感谢!

    2017-07-20 08:26:45

    共 2 条回复 >

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

    不知道这样对吗

python遇见数据采集

本教程让你初步掌握Python进行数据采集,创造属于你的价值

59669 学习 · 200 问题

查看课程

相似问题