Reputation: 3182
I want to add suffix to names of my files, for example uuid. How can i extract files using zipfile and pass custom names?
Upvotes: 2
Views: 2428
Reputation: 798676
Use ZipFile.open()
to open a read-only file-like to the file data, then copy it to a write-only file with the correct name using shutil.copyfileobj()
.
Upvotes: 4