# -*- coding: utf-8 -*- import sys import os import io import zipfile import mmap if __name__ == "__main__": with open("zip 파일"), "r+b") as zf: zip_file = zf.read() memory_map = mmap.mmap(-1, len(zip_file)) memory_map.write(zip_file) zip_file_data = zipfile.ZipFile(memory_map) """ 여기에 zip 파일을 처리할 코드를 작성한다. """ zip_file_data.close() memory_map.close()
<참고>
https://docs.python.org/3.6/library/mmap.html
http://barambunda.tistory.com/12
https://docs.python.org/3.6/library/zipfile.html