compress the text text file full of integer[python]

110 views Asked by At

My python code generates a list of list of integers like this [[1, 311 ,8], [5, 3, 23]]. however it has thousands of hundreds of integer and i have to run the code a hundred times. I have to store these results.

I keep them in a file where each list of integers is space separated and takes one line with following code:

with open(courpFile, 'a+', newline='') as myfile:
     wr = csv.writer(myfile, delimiter=' ')
     for simluate in corpus:
          for walk in simluate:
              wr.writerow(walk)

I have problem to keep these files as they take Gigabytes of space and I do not have. How can I compress them and extract them as needed any other recommendation can be good.

0

There are 0 answers