I wrote a code in python which looks like:
maplist=[{}]*11
mylist=[0]*11
maplist[0]['this']=1
print maplist
When I print maplist the output is :
[{'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}, {'this': 1}]
Expected is:
[{'this': 1}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]
rather than only the first element of the list should have this key in the map. What is causing this problem?