Search
 
SCRIPT & CODE EXAMPLE
 

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'))
Comment

PREVIOUS NEXT
Code Example
Python :: Fill data in dataframe in pandas for loop 
Python :: pandas change period to daily frequency 
Python :: while true python 
Python :: combine two columns pandas 
Python :: xgboost algorithm in python 
Python :: find pdf encrypted password with python 
Python :: py hash 
Python :: insert column in a dataframe 
Python :: pandas df sample 
Python :: face detection code 
Python :: even numbers from 1 to 100 in python 
Python :: torch.stack example 
Python :: list methods append in python 
Python :: python get array length 
Python :: import discord 
Python :: How do I merge two dictionaries in a single expression (taking union of dictionaries)? 
Python :: Copying a list using deepcopy() in python 
Python :: how to make a game in python 
Python :: new line in python 
Python :: sendgrid django smtp 
Python :: bin to int python 
Python :: python numpy delete element from array 
Python :: python flask how to remove last character from string 
Python :: python dict remove duplicates where name are not the same 
Python :: crawl a folder python 
Python :: flask session timeout 
Python :: beautifulsoup find text contains 
Python :: counter +1 python 
Python :: ordenar lista decrescente python 
Python :: py -m pip 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =