Explain Dictionary Indexing in Python?

Python Dictionary Index:

  • In Python Dictionary, the elements provide key-value indexing where the order is preserved.
  • Method to access Python Dictionary Index
  • Use the indexing syntax list[index] to return the key and also use the items() function to return a collection of all the dictionaries in the form of key-value pairs, which contain a tuple.

Syntax list[index] to return the value at index in list.


a_dictionary = {"a": 1, "b": 2} 
values = a_dictionary.values() 
values_list = list(values)
 a_value = values_list[0]