• Home
  • Raw
  • Download

Lines Matching full:zipfile

1 :mod:`zipfile` --- Work with ZIP archives
4 .. module:: zipfile
10 **Source code:** :source:`Lib/zipfile.py`
48 .. class:: ZipFile
52 :ref:`zipfile-objects` for constructor details.
74 methods of :class:`ZipFile` objects. Most users of the :mod:`zipfile` module
137 ZipFile Objects
141 .. class:: ZipFile(file, mode='r', compression=ZIP_STORED, allowZip64=True, \
167 If *allowZip64* is ``True`` (the default) zipfile will create ZIP files that
168 use the ZIP64 extensions when the zipfile is larger than 4 GiB. If it is
169 ``false`` :mod:`zipfile` will raise an exception when the ZIP file would
190 ZipFile is also a context manager and therefore supports the
194 with ZipFile('spam.zip', 'w') as myzip:
198 Added the ability to use :class:`ZipFile` as a context manager.
224 .. method:: ZipFile.close()
230 .. method:: ZipFile.getinfo(name)
237 .. method:: ZipFile.infolist()
244 .. method:: ZipFile.namelist()
249 .. method:: ZipFile.open(name, mode='r', pwd=None, *, force_zip64=False)
256 :meth:`~ZipFile.open` is also a context manager and therefore supports the
259 with ZipFile('spam.zip') as myzip:
268 These objects can operate independently of the ZipFile.
296 Calling :meth:`.open` on a closed ZipFile will raise a :exc:`ValueError`.
300 .. method:: ZipFile.extract(member, path=None, pwd=None)
321 Calling :meth:`extract` on a closed ZipFile will raise a
328 .. method:: ZipFile.extractall(path=None, members=None, pwd=None)
344 Calling :meth:`extractall` on a closed ZipFile will raise a
351 .. method:: ZipFile.printdir()
356 .. method:: ZipFile.setpassword(pwd)
361 .. method:: ZipFile.read(name, pwd=None)
367 :meth:`read` on a ZipFile that uses a compression method other than
373 Calling :meth:`read` on a closed ZipFile will raise a :exc:`ValueError`.
377 .. method:: ZipFile.testzip()
383 Calling :meth:`testzip` on a closed ZipFile will raise a
387 .. method:: ZipFile.write(filename, arcname=None, compress_type=None, \
414 Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
415 a closed ZipFile will raise a :exc:`ValueError`. Previously,
419 .. method:: ZipFile.writestr(zinfo_or_arcname, data, compress_type=None, \
446 Calling :meth:`writestr` on a ZipFile created with mode ``'r'`` or
447 a closed ZipFile will raise a :exc:`ValueError`. Previously,
453 .. attribute:: ZipFile.filename
457 .. attribute:: ZipFile.debug
463 .. attribute:: ZipFile.comment
467 :class:`ZipFile` instance created with mode ``'w'``, ``'x'`` or ``'a'``,
479 Construct a Path object from a ``root`` zipfile (which may be a
480 :class:`ZipFile` instance or ``file`` suitable for passing to
481 the :class:`ZipFile` constructor).
483 ``at`` specifies the location of this Path within the zipfile,
498 Invoke :meth:`ZipFile.open` on the current path.
505 :meth:`ZipFile.open`.
559 :class:`ZipFile` constructor, and one additional parameter, *optimize*.
570 Instances have one method in addition to those of :class:`ZipFile` objects:
635 :meth:`.infolist` methods of :class:`ZipFile` objects. Each object stores
788 .. program:: zipfile
793 The :mod:`zipfile` module provides a simple command-line interface to interact
801 $ python -m zipfile -c monty.zip spam.txt eggs.txt
807 $ python -m zipfile -c monty.zip life-of-brian_1979/
814 $ python -m zipfile -e monty.zip target-dir/
820 $ python -m zipfile -l monty.zip
826 .. cmdoption:: -l <zipfile>
827 --list <zipfile>
829 List files in a zipfile.
831 .. cmdoption:: -c <zipfile> <source1> ... <sourceN>
832 --create <zipfile> <source1> ... <sourceN>
834 Create zipfile from source files.
836 .. cmdoption:: -e <zipfile> <output_dir>
837 --extract <zipfile> <output_dir>
839 Extract zipfile into target directory.
841 .. cmdoption:: -t <zipfile>
842 --test <zipfile>
844 Test whether the zipfile is valid or not.
849 The extraction in zipfile module might fail due to some pitfalls listed below.
871 apply to zipfile library that can cause disk volume exhaustion.