Last active
May 10, 2017 15:21
-
-
Save jovianlin/c59dc518713e3801af088f7b5a18a87b to your computer and use it in GitHub Desktop.
Fix urllib for Python 2 and 3
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
from __future__ import print_function | |
import sys | |
if sys.version_info[0] >= 3: | |
from urllib.request import urlretrieve | |
else: | |
from urllib import urlretrieve | |
local_filename, headers = urlretrieve('http://jovianlin.com') | |
html = open(local_filename) | |
print(html) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment