Reversing the order of key-value pairs in a dictionary (Python) [duplicate]
问题 This question already has answers here : Python reverse dictionary items order (3 answers) Closed 3 days ago . How do I reverse the order of key-value pairs of a dictionary, in Python? For example, I have this dictionary: {"a":1, "b":2, "c":3} I want to reverse it so that it returns: {"c":3, "b":2, "a":1} Is there a function that I haven't heard about that can do this? Some lines of code is fine as well. 回答1: Dictionary does not have any sense of order , so your key/value pairs are not