How to save webpage using Python

The module urllib provides the function to access web url and we can save its content to a text file.

import urllib
link = "http://domain"
f = urllib.urlopen(link)
myfile = f.read()
print myfile

Where 'domain' is the website that we need to load.

All the contents will be available in the text file myfile.

 

Leave a Reply

Your email address will not be published. Required fields are marked *