Currently I have a .gz file of a csv file. And I would like to uncompressed it.
The difficulty is that after decompressing the .gz file, it needs a bitewise operation to get it to the right format.
I have the code in python that works, but I am struggling to convert it to R
def uncompress_file(file_location_gz, file_location_save): with open(file_location_gz, "rb") as f: data = f.read() data2 = gzip.GzipFile(fileobj=BytesIO(data), mode='rb').read() data2 = bytearray(data2) for i in range(len(data2)): data2[i] ^= 0x95 with open(file_location_save, 'wb') as f_out: f_out.write(data2)
Any help or suggestion would be really helpful.
Source: Python Questions