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.
75 methods of :class:`ZipFile` objects. Most users of the :mod:`zipfile` module
138 ZipFile Objects
142 .. class:: ZipFile(file, mode='r', compression=ZIP_STORED, allowZip64=True, \
169 If *allowZip64* is ``True`` (the default) zipfile will create ZIP files that
170 use the ZIP64 extensions when the zipfile is larger than 4 GiB. If it is
171 ``false`` :mod:`zipfile` will raise an exception when the ZIP file would
196 ZipFile is also a context manager and therefore supports the
200 with ZipFile('spam.zip', 'w') as myzip:
205 *metadata_encoding* is an instance-wide setting for the ZipFile.
217 Added the ability to use :class:`ZipFile` as a context manager.
244 metadata in the zipfile's directory and file headers.
247 .. method:: ZipFile.close()
253 .. method:: ZipFile.getinfo(name)
260 .. method:: ZipFile.infolist()
267 .. method:: ZipFile.namelist()
272 .. method:: ZipFile.open(name, mode='r', pwd=None, *, force_zip64=False)
280 :meth:`~ZipFile.open` is also a context manager and therefore supports the
283 with ZipFile('spam.zip') as myzip:
292 These objects can operate independently of the ZipFile.
316 :meth:`ZipFile.open` can now be used to write files into the archive with the
320 Calling :meth:`.open` on a closed ZipFile will raise a :exc:`ValueError`.
324 .. method:: ZipFile.extract(member, path=None, pwd=None)
345 Calling :meth:`extract` on a closed ZipFile will raise a
352 .. method:: ZipFile.extractall(path=None, members=None, pwd=None)
368 Calling :meth:`extractall` on a closed ZipFile will raise a
375 .. method:: ZipFile.printdir()
380 .. method:: ZipFile.setpassword(pwd)
385 .. method:: ZipFile.read(name, pwd=None)
391 Calling :meth:`read` on a ZipFile that uses a compression method other than
397 Calling :meth:`read` on a closed ZipFile will raise a :exc:`ValueError`.
401 .. method:: ZipFile.testzip()
407 Calling :meth:`testzip` on a closed ZipFile will raise a
411 .. method:: ZipFile.write(filename, arcname=None, compress_type=None, \
447 Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
448 a closed ZipFile will raise a :exc:`ValueError`. Previously,
452 .. method:: ZipFile.writestr(zinfo_or_arcname, data, compress_type=None, \
479 Calling :meth:`writestr` on a ZipFile created with mode ``'r'`` or
480 a closed ZipFile will raise a :exc:`ValueError`. Previously,
483 .. method:: ZipFile.mkdir(zinfo_or_directory, mode=511)
497 .. attribute:: ZipFile.filename
501 .. attribute:: ZipFile.debug
507 .. attribute:: ZipFile.comment
511 :class:`ZipFile` instance created with mode ``'w'``, ``'x'`` or ``'a'``,
523 Construct a Path object from a ``root`` zipfile (which may be a
524 :class:`ZipFile` instance or ``file`` suitable for passing to
525 the :class:`ZipFile` constructor).
527 ``at`` specifies the location of this Path within the zipfile,
542 Invoke :meth:`ZipFile.open` on the current path.
549 :meth:`ZipFile.open`.
631 ``zipp.Path`` in place of ``zipfile.Path`` for early access to
640 :class:`ZipFile` constructor, and one additional parameter, *optimize*.
651 Instances have one method in addition to those of :class:`ZipFile` objects:
716 :meth:`.infolist` methods of :class:`ZipFile` objects. Each object stores
869 .. program:: zipfile
874 The :mod:`zipfile` module provides a simple command-line interface to interact
882 $ python -m zipfile -c monty.zip spam.txt eggs.txt
888 $ python -m zipfile -c monty.zip life-of-brian_1979/
895 $ python -m zipfile -e monty.zip target-dir/
901 $ python -m zipfile -l monty.zip
907 .. cmdoption:: -l <zipfile>
908 --list <zipfile>
910 List files in a zipfile.
912 .. cmdoption:: -c <zipfile> <source1> ... <sourceN>
913 --create <zipfile> <source1> ... <sourceN>
915 Create zipfile from source files.
917 .. cmdoption:: -e <zipfile> <output_dir>
918 --extract <zipfile> <output_dir>
920 Extract zipfile into target directory.
922 .. cmdoption:: -t <zipfile>
923 --test <zipfile>
925 Test whether the zipfile is valid or not.
938 The extraction in zipfile module might fail due to some pitfalls listed below.
960 apply to zipfile library that can cause disk volume exhaustion.