0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

shutilを使ってpythonでzip圧縮

Posted at

#zip圧縮

import shutil

# DIR_NAME: zip圧縮するディレクトリのパス
# ROOT_NAME: 解凍後のルートディレクトリ名
shutil.make_archive(DIR_NAME, 'zip', ROOT_NAME)

#おまけ: 解凍

import zipfile

#ZIP_FILE_PATH: 回答するzipファイルのパス
#UNZIP_PATH: 解凍先ディレクトリ
with zipfile.ZipFile(ZIP_FILE_PATH) as zf:
    zf.extractall(UNZIP_PATH)

###詳細は以下 🥳
https://docs.python.org/ja/3/library/shutil.html

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?