标签: python dictionary
我有这个名称及其工作的例子字典
my_dict = {'al': 'sales', 'tony': 'engineer': 'fred': 'support'}
如果作业标题(值)在if语句中匹配,我想打印字典中条目的名称(键)。
job = input("what is the job?: ") if job in my_dict.values(): "print the key that has that job as a value"
怎么做?