'ZipFile does not store any text inside an archived file
The following code results in the file found in the zip being empty, instead of having some text in it:
def func(path):
with tempfile.NamedTemporaryFile() as f:
f.write('some text')
with zipfile.ZipFile(path + '.zip', 'w', zipfile.ZIP_DEFLATED) as zf:
zf.write((f.name), path)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
