Skip to content

Instantly share code, notes, and snippets.

@sooop
Created February 14, 2013 14:16
Show Gist options
  • Save sooop/4953096 to your computer and use it in GitHub Desktop.
Save sooop/4953096 to your computer and use it in GitHub Desktop.
getpage.py : connect some URL and print html source
#!/usr/bin/python
#-*-coding:utf-8
import urllib
import sys
def printHTML():
if len(sys.argv) < 2:
print("usage checkURL.py http://some.site.addr")
exit(1)
s = argv[1]
m = urllib.urlopen(s)
c = m.readline()
while c:
print c
c = m.readline()
m.close()
if __name__ == "__main__":
printHTML()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment