Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to print a value of a key in nested dictionary python

D = {'emp1': {'name': 'Bob', 'job': 'Mgr'},
     'emp2': {'name': 'Kim', 'job': 'Dev'},
     'emp3': {'name': 'Sam', 'job': 'Dev'}}

print(D['emp1']['name'])
# Prints Bob

print(D['emp2']['job'])
# Prints Dev
Source by www.learnbyexample.org #
 
PREVIOUS NEXT
Tagged: #print #key #nested #dictionary #python
ADD COMMENT
Topic
Name
4+6 =