Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

index a dictionary python

# Values:

a_dictionary = {"a": 1, "b": 2}

values = a_dictionary.values()
values_list = list(values)

a_value = values_list[0]

print(a_value) # Expected output: 1

# ---------------

# Keys

a_dictionary = {"a": 1, "b": 2}

keys_list = list(a_dictionary)

a_key = keys_list[0]

print(a_key) # Expected output: a
Source by www.kite.com #
 
PREVIOUS NEXT
Tagged: #index #dictionary #python
ADD COMMENT
Topic
Name
9+7 =