Mixed data types in dictionaries

Data Types in Python

Jason Myers

Instructor

Working with nested dictionaries

art_galleries.keys()
dict_keys(['10021', '10013', '10001', '10009', '10011',
   ...: '10022', '10027', '10019', '11106', '10128'])
print(art_galleries['10027'])
{"Paige's Art Gallery": '(212) 531-1577', 
 'Triple Candie': '(212) 865-0783', 
 'Africart Motherland Inc': '(212) 368-6802', 
 'Inner City Art Gallery Inc': '(212) 368-4941'}
  • The .keys() method shows the keys for a given dictionary
Data Types in Python

Accessing nested data

art_galleries['10027']['Inner City Art Gallery Inc']
'(212) 368-4941'
  • Common way to deal with repeating data structures
  • Can be accessed using multiple indices or the .get() method
Data Types in Python

Let's practice!

Data Types in Python

Preparing Video For Download...