How can I zip texts and images?
Hello!
I'm currently writing a Python script in which I have some text (as a string, not as a file) and images (as bytes, again not as a file), and I want to zip them all together. I know how to zip saved files using the Zipfile module. But I haven't saved the files; I've only saved them as strings or bytes objects.
Does anyone have any idea how to do this without temporarily saving the files? That would be a huge help!
Thank you in advance!
LG
This goes directly with the built-in zipfile:
https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile.open
Example:
Oh, then I didn’t really understand .write. I thought this can only pack files stored in the Zip File. Thank you.