Get value by key : get « Dictionary « Python Tutorial






dict = {'A':'1', 'B':'2' }
dict1 = dict.copy()
print dict1
print dict1.get('A')
print dict1.get('xxx')
print dict1.get('xxx', 'no such key')








8.10.get
8.10.1.Get value by key
8.10.2.get value from dictionary with default value