Multidimensional Dictionaries

Dictionaries may be nested.

dictionary = {
    'John': {'name': 'John Smith', 'phone': '123-555-0101'}, 
    'Jose': {'name': 'Jose Garcia', 'phone': '123-555-0102'}
}

print("John's name:", dictionary['John']['name'])
print("Jose's phone:",dictionary['Jose']['phone'])


Output:

John's name: John Smith
Jose's phone: 123-555-0102

results matching ""

    No results matching ""