Answer the question
In order to leave comments, you need to log in
How to add to the archive on a separate path, but so that the full folder is not written?
z = zipfile.ZipFile('spam.zip', 'w')
z.write('C:\Windows\explorer.exe')
z.close()
Answer the question
In order to leave comments, you need to log in
with zipfile.ZipFile('spam.zip', 'w') as z:
z.write('C:\Windows\explorer.exe', 'path/in/archive/and_new_name.exe')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question