Python dictionary copy demo code

From , 4 Years ago, written in Python, viewed 52 times.
URL https://pastebin.vip/view/251d52af
  1. L = [1,2,3]
  2. D = {'a':1, 'b':2}
  3.  
  4. A = L[:]              # instead of: A = L (or list(L))
  5. B = D.copy()          # instead of: B = D
  6.  
  7. A[1] = 'Ni'
  8. B['c'] = 'spam'
  9.  
  10. print L, D
  11.  
  12. print A, B

Reply to "Python dictionary copy demo code"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website