📜  索引字典 python 代码示例

📅  最后修改于: 2022-03-11 14:45:53.750000             🧑  作者: Mango

代码示例1
# 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