python zip folder
import shutil
shutil.make_archive(output_filename, 'zip', dir_name)
python zip folder
import shutil
shutil.make_archive(output_filename, 'zip', dir_name)
python zip folder
import os
import zipfile
def zip_directory(folder_path, zip_path):
with zipfile.ZipFile(zip_path, mode='w') as zipf:
len_dir_path = len(folder_path)
for root, _, files in os.walk(folder_path):
for file in files:
file_path = os.path.join(root, file)
zipf.write(file_path, file_path[len_dir_path:])
zip_directory('C:/FolderToZip', 'C:/Folder.zip')
python how to download zip
url = 'https://codeload.github.com/fogleman/Minecraft/zip/master'
# downloading with requests
# import the requests library
import requests
# download the file contents in binary format
r = requests.get(url)
# open method to open a file on your system and write the contents
with open("minemaster1.zip", "wb") as code:
code.write(r.content)
# downloading with urllib
# import the urllib library
import urllib
# Copy a network object to a local file
urllib.urlretrieve(url, "minemaster.zip")
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us