(directory, filename, url)
return filepath
Download filename from url unless it's already in directory.
Download filename from url unless it's already in directory.
Download filename from url unless it s already in directory .
def maybe_download(directory, filename, url):
  """Download filename from url unless it's already in directory."""
  if not os.path.exists(directory):
    print("Creating directory %s" % directory)
    os.mkdir(directory)
  filepath = os.path.join(directory, filename)
  if not os.path.exists(filepath):
    print("Downloading %s to %s" % (url, filepath))
    filepath, _ = urllib.request.urlretrieve(url, filepath)
    statinfo = os.stat(filepath)
    print("Succesfully downloaded", filename, statinfo.st_size, "bytes")
  return filepath
def maybe_download ( directory , filename , url ) : if not os . path . exists ( directory ) : print ( "Creating directory %s" % directory ) os . mkdir ( directory ) filepath = os . path . join ( directory , filename ) if not os . path . exists ( filepath ) : print ( "Downloading %s to %s" % ( url , filepath ) ) filepath , _ = urllib . request . urlretrieve ( url , filepath ) statinfo = os . stat ( filepath ) print ( "Succesfully downloaded" , filename , statinfo . st_size , "bytes" ) return filepath