How can this be explained?
x = [[]]*3 x[0].append('a') print(x)>>> returns [['a'], ['a'], ['a']]
Why does this list of lists end up with the same values
|
|
Messages In This Thread |
Why does this list of lists end up with the same values - by alehak - Jul-18-2019, 11:00 AM
RE: Append working - by stranac - Jul-18-2019, 11:48 AM
RE: Why does this list of lists end up with the same values - by perfringo - Jul-18-2019, 12:34 PM
|