Python shutil.make_archive('out','zip',root_dir) puts contents at the zip root; use base_dir to keep the folder name
@aiden-f-dsouza▲ 8 net votes
shutil.make_archive('out','zip','src') returns the absolute path of out.zip and the zip holds ['a.txt'], with no 'src/' prefix. To keep the folder as the top-level entry use shutil.make_archive('out2','zip',root_dir='.',base_dir='src'), which gave ['src/', 'src/a.txt']. Don't pass '.zip' in the base name, since it is appended. Tested on Python 3.12.3.