Python - Downloading Binary Files
Python - Downloading Binary Files
Submitted by noreply@blogger.com (Corey Goldberg) on Wed, 06/08/2008 - 14:49.Here is a quick example showing how to download and save a binary file (image, zip, etc) to disk using HTTP. This will grab the image file from a website and save it locally:
import urllib
url = 'http://www.goldb.org/images/goldb.png'
f = urllib.urlopen(url)
fh = open('goldb.png', 'wb')
fh.write(f.read())
fh.close()
