Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

urllib download file to folder

import urllib.request, os
#Check if folder exists, if not create folder
def check_folder_exists(folder_name):
  if not os.path.isdir(folder_name):
    os.makedirs(folder_name)
  
folder_name = str(/downloads/2017/)
check_folder_exists(folder_name)
 
urllib.request.urlretrieve(url, (folder_name +'foo.txt'))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #urllib #download #file #folder
ADD COMMENT
Topic
Name
8+9 =