Use shutil, which is part of python standard library set.
Using shutil is so simple(see code below):
- 1st arg: Filename of resultant zip/tar file,
- 2nd arg: zip/tar,
- 3rd arg: dir_name
Code:
import shutil
shutil.make_archive('/home/user/Desktop/Filename','zip','/home/username/Desktop/Directory')