I have a huge list of float values and a small list of float values. I want to break my huge list into several smaller lists with each having a length equal to the length of my small list.
As an example, consider:
huge = [1.2,3.0,5.6,8.9,10.7,4.3,7.6,9.8,11.6,13.2,12.8,14.5] # len = 12
small = [1,2,3] # len = 3
numlist = len(huge)/len(small) # 4 sublists in listomega
listomega = [[] for index in range(numlist)] # index = 0,1,2,3
### ????
print(listomega)
>>> [[1.2,3.0,5.6],[8.9,10.7,4.3],[7.6,9.8,11.6],[13.2,12.8,14.5]]
print(listomega[0])
>>> [1.2,3.0,5.6]
How can I go about doing this?
I noticed this answer which seemed to have a solution, though I cannot print the result.
print(chunks(l, n))
>>> <generator object chunks at 0x10b3f1f68>