fileinput usage with openbook=hook_compressed
问题 I'm trying fileinput to read some compressed files, and I tried the following three methods, however, none of them really works. file=os.join.path(path+filename) for i,line in enumerate(fileinput([file], openhook=gzip.open)): for i,line in enumerate(fileinput.input(openhook=fileinput.hook_compressed(file1,'r'))): for i,line in enumerate(fileinput.FileInput(openhook=fileinput.hook_compressed(file1,'r'))): For the first command, errors are like: 'module' object is not callable For the third