I have a similar problem to a question over here with the following code:
import zipfile
report_zip = "C:\Users\user\Desktop\report.zip"
report = "C:\Users\user\Desktop\report.json"
json_zip = zipfile.ZipFile(report_zip, "w")
try:
json_zip.write(report)
finally:
json_zip.close()
The result of the code is as such:
report.zip
--Users
--user
--Desktop
--report.json
Whereas what I want is:
report.zip
--report.json
How should I modify my current implementation to achieve this? Or is there a better implementation? Many thanks in advance.