Import error: No module name urllib2 in python 3
Here's my code:
import urllib2.request
response = urllib2.urlopen("http://www.google.com")
html = response.read()
print(html)
Any help?
To solve importerror: no module named 'urllib2' efficiently you should follow the below-mentioned code to get rid of import error:-
from urllib.request import urlopen
html = urlopen("http://www.google.com/").read()
print(html)