Oc Ubuntu 16.04
How to correctly add all the files from the current folder to the archive?
Read the manual, found 2 ways.
The question is, is there a better way?
Or something like this tar.addall
1st method
import tarfile tar = tarfile.open("tar/sample.tar.gz", "w:gz") for name in ["./"]: tar.add(name) tar.close() 2nd way
import tarfile import subprocess subprocess.call('python3 -m tarfile -c tar/sample.tar.gz *', shell=True) The question is, is there something else or are these 2 methods correct for this task?