Sep-18-2018, 11:47 PM
Windspar thank you for your second example i didn t know about shallow copy
Anyway i think that my problem isn t caused by the absence of a shallow copy
Posting that stackexchange i brought you outside the road sorry
As Larz60+ suggested this is my aim:
In my code i am creating a dict with random numbers (dict_p) then i would like to add (append) this dict to a list (list_p)
This is my output
I would like that is was filled with different random generated dict
Anyway i think that my problem isn t caused by the absence of a shallow copy
Posting that stackexchange i brought you outside the road sorry
As Larz60+ suggested this is my aim:
In my code i am creating a dict with random numbers (dict_p) then i would like to add (append) this dict to a list (list_p)
This is my output
[{'test': 'gamma', '12': 3.89, 'NG': 0.06, '1': 2.82, '2': 4.31, 'GG': 0.95}, {'test': 'gamma', '12': 3.89, 'NG': 0.06, '1': 2.82, '2': 4.31, 'GG': 0.95}, {'test': 'gamma', '12': 3.89, 'NG': 0.06, '1': 2.82, '2': 4.31, 'GG': 0.95}]It shouldn t be all the same. For some reason that i don t understand the list is filled always with the last appended dict
I would like that is was filled with different random generated dict