![]() Compress individual files into a ZIP file Specific examples are described in the following sections. Input and Output - Reading and Writing Files - Python 3.10.2 documentation The usage is similar to reading and writing files with the built-in function open(), such as specifying the mode and using the with statement. The ZipFile object needs to be closed with the close() method, but if you use the with statement, it is closed automatically when the block is finished. ZipFile objects are created by specifying the first parameter file (path of a ZIP file) and the second parameter mode (read 'r', write 'w', append 'a', etc.) to the constructor zipfile.ZipFile(). zipfile - ZipFile Objects - Work with ZIP archives - Python 3.10.2 documentation.The zipfile module provides the ZipFile class to create, read, write, append, and list a ZIP file. Dir_out_base └── dir_zip ├── dir_sub │ └── file_sub.txt └── file.txt Basics of the zipfile module: ZipFile objects
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |