Python is easy! (Hitting a URL)

Posted April 19, 2005

Amazing how complete the language of Python is. Here is a little snippet that is available all over the place on how to hit a URL and get the text back. Give it a try.

import urllib
sock = urllib.urlopen(“http://microsoft.com”)
htmlSource = sock.read()
sock.close()
print htmlSource

Posted in Linux, Software

Tags:

Leave a Reply