urllib.error.URLError:

后端 未结 4 1352
-上瘾入骨i
-上瘾入骨i 2020-11-29 12:09

(Python 3.4.2) I\'ve got a weird error when I run \'urllib.request.urlopen(url)\' inside of a script. If I run it directly in the Python interpreter, it works fine, but not

4条回答
  •  旧时难觅i
    2020-11-29 12:51

    I figured it out. My url had a : in it, and urllib cannot use that character. I replaced it with %3A and now it's working. Web browsers usually convert : to %3A automatically, but urllib requires it to be converted first.

提交回复
热议问题