文書の表示以前のリビジョンバックリンク文書の先頭へ この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。 ====== ZIPの一括解凍 ====== 一括解凍とはいっても,ファイル名に学習番号や氏名が入っており,それで提出物が統一されていると,そのファイル名ディレクトリの中に展開したいわけで.うまくコマンドでできるかとおもったんですが,pythonが早かったです. <file .py unzipSameName.py> import os import sys import zipfile args = sys.argv[1:] for filename in args: with zipfile.ZipFile(filename) as existing_zip: directory_name = os.path.basename(filename) parent_directory = os.path.dirname(filename) ftitle, text = os.path.splitext(directory_name) print(parent_directory+"/"+ftitle) existing_zip.extractall(parent_directory+"/"+ftitle) </file> /home/users/2/lolipop.jp-4404d470cd64c603/web/ws/data/pages/課題をさばく/zipの一括解凍.txt 最終更新: 2020/01/22 15:45by baba