1👍
✅
Try to use writestr
Signature: writestr(zinfo_or_arcname, data, compress_type=None)
Docstring: Write a file into the archive. The contents is ‘data’,
which may be either a ‘str’ or a ‘bytes’ instance; if it is a ‘str’,
it is encoded as UTF-8 first. ‘zinfo_or_arcname’ is either a ZipInfo
instance or the name of the file in the archive.
Source:stackexchange.com