Skip to content Skip to sidebar Skip to footer

Make In-memory Copy Of A Zip By Iterating Over Each File Of The Input

Python, as far as know, does not allow modification of an archived file. That is why I want to: Unpack the zip in memory (zip_in). Go over each file in the zip_in, and change it i

Solution 1:

ZipFile.extract() expects a filename, not a file-like object to write to. Instead, use ZipFile.read(name) to get the contents of the file. It returns the byte string so will work fine with binary files. Text files may require decoding to unicode.


Post a Comment for "Make In-memory Copy Of A Zip By Iterating Over Each File Of The Input"