Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to access a dictionary within a dictionary in python

people = {1: {'name': 'John', 'age': '27', 'sex': 'Male'},
          2: {'name': 'Marie', 'age': '22', 'sex': 'Female'}}

print(people[1]['name'])
print(people[1]['age'])
print(people[1]['sex'])
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #access #dictionary #dictionary #python
ADD COMMENT
Topic
Name
2+7 =