Python Accessing Values in a Dictionary

Posted by Samath
  356
January 13, 2017

 

In this program I show how to access values in a Dictionary using the python programming language. 

d = {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}

print 'value for k1 = ', d['k1']

print 'value for k2 = ', d.get('k2')