I have a big list of lists like this in Python 3:
array = [[262,231],[123,222],[237272,292]...]
I want to save this in binary in python I tried this:
output = open("pratica3.dat", "wb")
inbytes = bytes(array)
output.write(inbytes)
But this gives an error:
TypeError: 'list' object cannot be interpreted as an integer
And if I try to run through the list and save, this gives me annother error of out of range 256
bytesdoesn't work on arbitrary data structures. Trypickle.json?pickle? Is there any specific format? e.g. the array contains sublists of length 2 that only hold integers? In that case, you can probably get the most minimal file size usingnumpy.