1import gzip 2import sys 3 4with gzip.open(sys.argv[1], 'rb') as f: 5 writer = getattr(sys.stdout, 'buffer', None) 6 if writer is None: 7 writer = sys.stdout 8 if sys.platform == "win32": 9 import os, msvcrt 10 msvcrt.setmode(sys.stdout.fileno(),os.O_BINARY) 11 12 writer.write(f.read()) 13 sys.stdout.flush() 14