I encountered this problem when creating lists. Can someone explain why there is a difference between the two lists?
bucket = [ ]
for n in range(5):
bucket.append([])
lists = [ [ ] ]*(5)
for n in range(5):
bucket[n].append(n)
lists[n].append(n)
print bucket
# [[0], [1], [2], [3], [4]]
print lists
# [[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]