Skip to content

Instantly share code, notes, and snippets.

@MinxianLi
Created November 2, 2015 02:28
Show Gist options
  • Save MinxianLi/db2538dc2eaa4bffae0d to your computer and use it in GitHub Desktop.
Save MinxianLi/db2538dc2eaa4bffae0d to your computer and use it in GitHub Desktop.
ONLY WORKS FOR PYTHON 2.
import urllib
file = urllib.urlopen("http://www.python.org")
s = file.read()
f.close()
#I'm guessing this would output the html source code?
print(s)
CREDIT: http://stackoverflow.com/questions/3969726/attributeerror-module-object-has-no-attribute-urlopen
http://www.boddie.org.uk/python/HTML.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment