Created
November 15, 2016 12:24
-
-
Save zhengxiaowai/7f961d2cf363f36d116c5559dc2ce818 to your computer and use it in GitHub Desktop.
压缩一个文件夹,没有文件目录
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def zip_dir(zipfile_path, zip_dir_path, file_tyle='*'): | |
with zipfile.ZipFile(zipfile_path, 'w') as z: | |
glob_file = glob.glob(os.path.join(zip_dir_path, file_tyle)) | |
for filepath in glob_file: | |
z.write(filepath, os.path.basename(filepath)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment