file compression

Skip Montanaro skip at pobox.com
Tue Jun 29 05:02:23 CEST 2004


    Elaine> The files I'm working with are python modules and LaTeX source
    Elaine> files, and I need to make them into archives so I can store them
    Elaine> in my website.

Check out the zipfile module and class:

    % pydoc zipfile
    ...
    class ZipFile
     |  Class with methods to open, read, write, close, list zip files.
     |  
     |  z = ZipFile(file, mode="r", compression=ZIP_STORED)
     |  
     |  file: Either the path to the file, or a file-like object.
     |        If it is a path, the file will be opened and closed by ZipFile.
     |  mode: The mode can be either read "r", write "w" or append "a".
     |  compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib)
     ...

Skip




More information about the Python-list mailing list