Changing one dict changes all dicts in a list of dicts [duplicate]
问题 This question already has answers here : List of lists changes reflected across sublists unexpectedly (13 answers) Closed 4 months ago . I have a list of dicts for storing data. When I make change in one dict, that change is reflected in all dicts. students = [{"marks": [], "subjects": 0}]*3 specific_student = 2 print("Before updating", students) students[specific_student]["marks"].append(50) students[specific_student]["subjects"] += 1 print("After updating", students) I was expecting that,