copy method returns a duplicate shallow dictionary : Copy : Dictionary PYTHON TUTORIALS


PYTHON TUTORIALS » Dictionary » Copy »

 

copy method returns a duplicate shallow dictionary


x = {'username': 'admin', 'machines': ['foo', 'bar', 'baz']}
y = x.copy()

y['username'] 'mlh'
y['machines'].remove('bar')
print y
print x



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Dictionary
» Copy