Why can't I get Python's urlopen() method to work on Windows?

前端 未结 4 1486
一生所求
一生所求 2020-12-04 02:16

Why isn\'t this simple Python code working?

import urllib
file = urllib.urlopen(\'http://www.google.com\')
print file.read()

This is the er

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 02:51

    Your code is not the problem here.

    Do you have any Proxy settings in your IE?

    This says the python documentation for urllib.urlopen:

    In a Windows environment, if no proxy environment variables are set,
    proxy settings are obtained from the registry's Internet Settings
    section.

提交回复
热议问题