bal_gennady

глубокое коппирование

Dec 15th, 2019
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.22 KB | None | 0 0
  1. import copy
  2.  
  3. slovar={'a' : 0, 'b' : 1, 'c': [0,1]}
  4. massiv=[]
  5.  
  6. for x in range(10):
  7.     massiv.append(copy.deepcopy(slovar))
  8.  
  9. massiv[0]['a']=2
  10. massiv[1]['c'][0]=33
  11.  
  12. print(str(massiv[0]))
  13. print(str(massiv[1]))
Add Comment
Please, Sign In to add comment