N
N
NitroDesktop2020-05-14 12:23:15
Python
NitroDesktop, 2020-05-14 12:23:15

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

1 answer(s)
S
Sergey Pankov, 2020-05-14
@NitroDesktop

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 question

Ask a Question

731 491 924 answers to any question