python 对于一个字典,根据其value值获取其对应的keys值
def get_keys(d, value):
return [k for k,v in d.items() if v == value]
get_keys({'a':'001', 'b':'002',"c":'001'}, '001')
def get_keys(d, value):
return [k for k,v in d.items() if v == value]
get_keys({'a':'001', 'b':'002',"c":'001'}, '001')