Import error: No module name urllib2

后端 未结 9 1107
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 06:42

Here\'s my code:

import urllib2.request

response = urllib2.urlopen(\"http://www.google.com\")
html = response.read()
print(html)

Any help?

9条回答
  •  日久生厌
    2020-11-22 07:29

    Simplest of all solutions:

    In Python 3.x:

    import urllib.request
    url = "https://api.github.com/users?since=100"
    request = urllib.request.Request(url)
    response = urllib.request.urlopen(request)
    data_content = response.read()
    print(data_content)
    

提交回复
热议问题