Pythonでファイルをzip化する方法はいくつかありますが、一番簡単なのは「 shutil 」モジュールの make_archiveメソッドを使う方法です。
tmp/test ディレクトリ内のファイルを backup.zip ファイルに圧縮しています。
import shutil
shutil.make_archive('backup', 'zip', root_dir='/tmp/test')
今回は以上となります。
Powershell
Windows
Powershell
Mac
Python
Windows
AWS
Code
Code
Powershell
AWS
Powershell
Powershell
Python
Powershell
PlantUML
Windows
PythonPythonでファイルをzip化する方法はいくつかありますが、一番簡単なのは「 shutil 」モジュールの make_archiveメソッドを使う方法です。
tmp/test ディレクトリ内のファイルを backup.zip ファイルに圧縮しています。
import shutil
shutil.make_archive('backup', 'zip', root_dir='/tmp/test')
今回は以上となります。
Windows
コメント