0
0 Comments

I am trying to save some data to a file using pickle. My starting list has the form:

a1 = [[190, 187, 27, 24, 4, 1, 0, 2, 6, 9, 60, 62], [190, 187, 27, 24, 4, 1, 0, 2, 6, 9, 61, 65], [190, 187, 27, 24, 4, 1, 0, 2, 6, 9, 60, 63], [190, 187, 27, 24, 4, 1, 0, 2, 6, 9, 61, 65], [190, 187, 27, 24, 4, 1, 0, 2, 6, 8, 48, 50], [190, 187, 27, 24, 4, 1, 0, 2, 6, 9, 61, 64], [190, 187, 27, 24, 4, 1, 0, 2, 6, 8, 48, 51]]

After leaving only the first and last digits from the sub-lists:

a2 = [[190, 62], [190, 65], [190, 63], [190, 65], [190, 50], [190, 64], [190, 51]]

And after my base-32 coding:

[['5x', '1x'], ['5x', '21'], ['5x', '1c'], ['5x', '21'], ['5x', '1o'], ['5x', '20'], ['5x', '1p']]

File with list ‘a1’ has 224 bytes, with list ‘a2’ has 84 bytes, and with list ‘a3’ has 182 bytes. Why is the file with the ‘a3’ list bigger than the file with the ‘a2’ list? Do quotes enlarge the file? It seemed to me that, for example, “5x” would take less than “190”, and at the same time would reduce the weight of the entire file. Are there other more effective ways of storing such data in files?

Answered question