fileinput.hook_compressed(filename, mode)
Transparently opens files compressed with gzip and bzip2 (recognized by the extensions '.gz'
and '.bz2'
) using the gzip
and bz2
modules. If the filename extension is not '.gz'
or '.bz2'
, the file is opened normally (ie, using open()
without any decompression).
Usage example: fi = fileinput.FileInput(openhook=fileinput.hook_compressed)
Please login to continue.