Read and write bzip2-compressed files.
Bz2file is a Python library for reading and writing bzip2-compressed files.
It contains a drop-in replacement for the file interface in the standard library’s bz2 module, including features from the latest development version of CPython that are not available in older releases.
Bz2file is compatible with Python 2.6, 2.7, and 3.0 through 3.4.
- Supports multi-stream files.
- Can read from or write to any file-like object.
- Can open files in either text or binary mode.
- Added methods: peek(), read1(), readinto(), fileno(), readable(), writable(), seekable().
To install bz2file, run:
$ pip install bz2file
The open() function and BZ2File class in this module provide the same features and interface as the ones in the standard library’s bz2 module in the current development version of CPython, documented here.
0.95: 08 October 2012
- Added the open() function.
- Improved performance when reading in small chunks.
- Removed the fileobj argument to BZ2File(). To wrap an existing file object, pass it as the first argument (filename).
0.9: 04 February 2012
- Initial release.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size bz2file-0.95.tar.gz (10.6 kB)||File type Source||Python version None||Upload date||Hashes View|