Python里面的字典能不能通过值value来找到对应的键key

2025-05-19 13:00:35
推荐回答(1个)
回答1:

可以的。例:
d = {'1':'one','2':'two','3':'three'}
last = d.values()[2]
second = d['2']

print(last)
print(second)
输出:
two
two
明白了吗?还没有的话可以追问