Generating sublists using multiplication ( * ) unexpected behavior [duplicate]
问题 This question already has answers here : List of lists changes reflected across sublists unexpectedly (13 answers) Nested List Indices [duplicate] (2 answers) Closed 6 years ago . I'm sure this has been answered somewhere but I wasn't sure how to describe it. Let's say I want to create a list containing 3 empty lists, like so: lst = [[], [], []] I thought I was being all clever by doing this: lst = [[]] * 3 But I discovered, after debugging some weird behavior, that this caused an append