12.3 bz2 -- Compression compatible with bzip2

Python 2.5

12.3 bz2 -- Compression compatible with bzip2

New in version 2.3.

This module provides a comprehensive interface for the bz2 compression library. It implements a complete file interface, one-shot (de)compression functions, and types for sequential (de)compression.

Here is a resume of the features offered by the bz2 module:

  • BZ2File class implements a complete file interface, including readline(), readlines(), writelines(), seek(), etc;
  • BZ2File class implements emulated seek() support;
  • BZ2File class implements universal newline support;
  • BZ2File class offers an optimized line iteration using the readahead algorithm borrowed from file objects;
  • Sequential (de)compression supported by BZ2Compressor and BZ2Decompressor classes;
  • One-shot (de)compression supported by compress() and decompress() functions;
  • Thread safety uses individual locking mechanism;
  • Complete inline documentation;


See About this document... for information on suggesting changes.