Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

print page info

View print-page-info.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14
try:
from urllib2 import urlopen
except ImportError:
from urllib.request import urlopen
 
url, encoding = 'http://stackoverflow.com/q/9445627/', 'utf-8'
response = urlopen(url)
print(response.info())
 
page_bytes = response.read()
print("Raw bytes:")
print(repr(page_bytes[:40]))
print("Decoded:")
print(page_bytes.decode(encoding))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.