urlretrieve 在 python3 裡寫法不一樣了。會有 Error:
AttributeError: module 'urllib' has no attribute 'urlretrieve'
解法:
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
# Not Python 3 - today, it is most likely to be Python 2
# But note that this might need an update when Python 4
# might be around one day
from urllib import urlretrieve
# Get file from URL like this:
urlretrieve("http://your-url-here")