<分区> 分区>
Possible Duplicate:
Inverse dictionary lookup - Python
在 Python 中是否有内置的按值索引字典的方法。
例如像这样的东西:
dict = {'fruit':'apple','colour':'blue','meat':'beef'}
print key where dict[key] == 'apple'
或:
dict = {'fruit':['apple', 'banana'], 'colour':'blue'}
print key where 'apple' in dict[key]
还是我必须手动循环播放?
