0 votes
1 view
ago in Python by (19.5k points)

Here's my code:

import urllib2.request 

response = urllib2.urlopen("http://www.google.com") 

html = response.read() 

print(html)

Any help?

1 Answer

0 votes
ago by (46.1k points)

Instead of your code you can use the below-mentioned code to get rid of import error:-

from urllib.request import urlopen 

html = urlopen("http://www.google.com/").read() 

print(html)

...