Created
August 16, 2012 18:09
-
-
Save hamaluik/3372222 to your computer and use it in GitHub Desktop.
Getting HTML Data From a Webpage Using Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2 | |
# get the html of a url | |
def GetHTML(url): | |
# open it up | |
f = urllib2.urlopen(url) | |
str = f.read() | |
return str | |
# now use it! | |
html = GetHTML('http://google.ca/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment