def downloadURL(url, fname):
 fpIn = urllib_request.urlopen(url)
 fpOut = open(fname, 'wb')
 block = fpIn.read(10240)
 try:
  while block:
   fpOut.write(block)
   block = fpIn.read(10240)
  fpIn.close()
  fpOut.close()
 except:
  try:
   os.unlink(fname)
  except:
   pass

def downloadURL ( url , fname ) : fpIn = urllib_request . urlopen ( url ) fpOut = open ( fname , 'wb' ) block = fpIn . read ( 10240 ) try : while block : fpOut . write ( block ) block = fpIn . read ( 10240 ) fpIn . close ( ) fpOut . close ( ) except : try : os . unlink ( fname ) except : pass
download the contents of the url into the file .