key:value ----> value: [k1, k2],
def kv_reversal(data_dict):# key-value 互换,value有重复kv_list = defaultdict(list)for k, v in data_dict.items():kv_list[v].append(k)kv_list = dict(kv_list)return kv_list
key:value ----> value: [k1, k2],
def kv_reversal(data_dict):# key-value 互换,value有重复kv_list = defaultdict(list)for k, v in data_dict.items():kv_list[v].append(k)kv_list = dict(kv_list)return kv_list