I'm new with Python and for some needs I am trying to figure out how to work with list of lists of lists.
Here's what am I doing:
segment_coef = [[list()]*4]*17
print segment_coef
segment_coef[0][0].append(1)
segment_coef[1][0].append(2)
segment_coef[2][0].append(3)
print segment_coef
After first print
I have :
[ [ [],[],[],[] ] , ... 14 more time ... , [ [],[],[],[] ] ]
After these three append
commands I'd like to have smth like:
[ [ [1],[],[],[] ] , [ [2],[],[],[] ], [ [3],[],[],[] ] ]
But I've got:
[ [ [1,2,3],[1,2,3],[1,2,3],[1,2,3] ] , [ [1,2,3],[1,2,3],[1,2,3],[1,2,3] ], ... up to the end ]
What am I doing wrong?