python3;
两层字典
dict =(type, dict2)
dict2 = (k_value, index)
dictss = { 10: {3: 1, 4: 2, 5: 3, 6: 4, 7: 5, 8: 6, 9: 7, 10: 8, 11: 9, 12: 10, 13: 11, 14: 12, 15: 13, 16: 14, 17: 15, }, 20: {3: 16, 4: 17, 5: 18, 6: 19, 7: 20, 8: 21, 9: 22, 10: 23, 11: 24, 12: 25, 13: 26, 14: 27, 15: 28, },}
反向转置字典,
dict = (index, type)
rev_dictss = {} for (k, v) in dictss.items(): # print(dict(v)) for vk, vv in v.items(): # print(vv, vk) rev_dictss[vv] = k print(rev_dictss)
原文地址:https://www.cnblogs.com/xiaoniu-666/p/10553812.html
时间: 2024-11-13 08:10:25