title: Saving a downloaded ZIP file w/Python
body: <p>I'm working on a script that will automatically update an installed version of Calibre.  Currently I have it downloading the latest portable version.  I seem to be having trouble saving the zipfile. Currently my code is:</p>
  
  <pre><code>import urllib2
  import re
  import zipfile
  
  #tell the user what is happening
  print("Calibre is Updating")
  
  #download the page
  url = urllib2.urlopen ( "http://sourceforge.net/projects/calibre/files" ).read()
  
  #determin current version
  result = re.search('title="/[0-9.]*/([a-zA-Z\-]*-[0-9\.]*)', url).groups()[0][:-1]
  
  #download file
  download = "http://status.calibre-ebook.com/dist/portable/" + result
  urllib2.urlopen( download )
  
  #save
  output = open('install.zip', 'w')
  output.write(zipfile.ZipFile("install.zip", ""))
  output.close()
  </code></pre>