Python is easy! (Hitting a URL)

      No Comments on Python is easy! (Hitting a URL)

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

Leave a Reply