import argparse
import zipfile
import os
def unzip_files(input_file_path: str, output_dir_pass: str) -> None:
with zipfile.ZipFile(input_file_path, "r") as zip:
for item in zip.namelist():
zip.extract(item, output_dir_pass)
def main() -> None:
parse = argparse.ArgumentParser()
parse.add_argument("--input_file_path", "-i", default="./image.zip")
parse.add_argument("--output_dir_pass", "-o", default=None)
args = parse.parse_args()
if not args.output_dir_pass:
args.output_dir_pass = os.getcwd()
unzip_files(args.input_file_path, args.output_dir_pass)
if __name__ == "__main__":
main()
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme