I have a code that compress every file in a specific folder with zip but I want to compress it with 7zip, so how to do ?
This is what I have so far:
There doesn't appear to be a good Python module for creating a 7z archive (despite what the documentation says, py7zlib can only read them).
A workaround is to download the 7z SDK (http://www.7-zip.org/sdk.html) and use the 7zr executables that come with it via the subprocess module. 7z is in the public domain so you can carry this standalone program around without restriction.
You can try the command line method
import subprocess
subprocess.call(['7z', 'a', filename+'.7z', filename])
or for all files in folder
subprocess.call(['7z', 'a', filename+'.7z', "*.*"])