py7zlib

How to read from a text file compressed with 7z?

做~自己de王妃 提交于 2019-11-27 05:54:18
问题 I would like to read (in Python 2.7), line by line, from a csv (text) file, which is 7z compressed. I don't want to decompress the entire (large) file, but to stream the lines. I tried pylzma.decompressobj() unsuccessfully. I get a data error. Note that this code doesn't yet read line by line: input_filename = r"testing.csv.7z" with open(input_filename, 'rb') as infile: obj = pylzma.decompressobj() o = open('decompressed.raw', 'wb') obj = pylzma.decompressobj() while True: tmp = infile.read(1

工具导航Map

JSON相关