Reading in a batch of syslog files. Some of them have been compressed:
syslog
syslog.1
syslog.2.gz
syslog.3.gz
syslog.4.gz
with open(args.filename_path, "rb") as file:
Everything seems to work ok when using gzip.open in the with
statement when the extension is gz
:
with gzip.open(args.filename_path, "rb") as file:
How to get the gzip.open
when it's a gz
file but use open
when it's a "normal" file.