Is there anyway I can zip dynamically generated content, such as a freshly rendered html template, into a zip file using zipfile?
There seem to be some examples arou
You can add whatever you want to a zip file using ZipFile.writestr():
my_data = "Hello, world!" z.writestr("hello.html", my_data)
Hello, world!
You can also use sub-folders using / (or os.sep) as a separator:
/
os.sep
z.writestr("site/foo/hello/index.html", my_data)