python 中实现字典的逆转
001、
>>> test1 = dict(c = 500, a = 300, b = 200, e = 600, d = 777) >>> test1 {'c': 500, 'a': 300, 'b': 200, 'e': 600, 'd': 777} >>> test2 = dict() >>> for i,j in reversed(list(test1.items())): ## 字典逆转 ... test2[i] = j ... >>> test2 {'d': 777, 'e': 600, 'b': 200, 'a': 300, 'c': 500}

浙公网安备 33010602011771号