Append item to a specified list in a list of lists (Python) [duplicate]
问题 This question already has answers here : List of lists changes reflected across sublists unexpectedly (13 answers) Closed 6 years ago . I'm practicing my progamming skills by solving problems from project euler at the moment, and now I've come across some (in my opinion) strange behavior on Python. When I do: list = [[1]]*20 I get a list of 20 lists containing element 1, as expected. However, when I would like to append a 2 to the third element from this list, I would do that as follows: list