Python add new item to a dictionary

Posted by Samath
  409
January 13, 2017

 

In this Python program I show how to add new item to a dictionary.

d = {}
d['k1'] = 'v1'
d['k2'] = 12345
d['k3'] = ['a', 'b', 'c']
d['k4'] = (1, 2, 3)
print 'd = ', d