Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k 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
by (106k points)
edited by

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)

To know more about this you can have a look at the following video tutorial:-

Interested to learn more about Python? Come & join our Python course

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...