I want to create a fixed size list of size 6 of tuples in Python. Note that in the code below i am always re-initializing the values in the outer for loop in order to reset the previously created list which was already added to globalList. Here is a snippet:
for i,j in dictCaseId.iteritems():
listItems=[None]*6
for x,y in j:
if x=='cond':
tuppo = y
listItems.insert(0,tuppo)
if x=='act':
tuppo = y
listItems.insert(1,tuppo)
if x=='correc':
tuppo = y
listItems.insert(2,tuppo)
...
...
globalList.append(listItems)
But when I try to run the above (snippet only shown above) it increases the list size. I mean, stuff gets added but I also see the list contains more number of elements. I dont want my list size to increase and my list is a list of 6 tuples.
For example:
Initially: [None,None,None,None,None,None]
What I desire: [Mark,None,Jon,None,None,None]
What I get: [Mark,None,Jon,None,None,None,None,None]