سؤال

How to create *.7z file in Python? Please write an small-simple example.

هل كانت مفيدة؟

المحلول

You can try using py7zr, which supports 7zip archive compression, decompression, encryption, decryption. https://github.com/miurahr/py7zr

For .7z creation, use this code:

import py7zr
with py7zr.SevenZipFile('target.7z', 'w') as z:
    z.writeall('./base_dir')

نصائح أخرى

You need py7zlib, see this question

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top