Dictionary copy

#The copy method returns a new dictionary with the same key-value pairs (a "shallow
#copy," since the values themselves are the same, not copies):
x = {'username': 'admin', 'machines': ['foo', 'bar', 'baz']}
y = x.copy()
y['username'] = 'mlh'
y['machines'].remove('bar')
print y
print x
Related examples in the same category