Using zipfile to create a zip file with directories and files
Michael Torrie
torriem at gmail.com
Sat Mar 7 07:48:48 EST 2020
On 3/7/20 1:08 AM, musbur at posteo.org wrote:
> On Fri, 6 Mar 2020 20:06:40 -0700
> Michael Torrie <torriem at gmail.com> wrote:
>
>> The documentation talks about writing files from
>> disk, but I'm interested in creating these files from within Python
>> directly in the zip archive.
>
> But you have seen writestr(), haven't you?
Yes, that's what I was using. Turns out I didn't look closely enough at the exception I was getting. What i thought was zipfile complaining about a '/' character was really Python complaining about a bad string formatting string I was using!
Thanks for confirming that zipfile indeed should work the way I hoped it wood. I'm in business now.
thank you.
More information about the Python-list
mailing list