I am referring to the question: https://stackoverflow.com/a/575889/292291
If I use integers as the key, it appears I am guaranteed a sorted order?
>>> dict = { 2: "list 2", 0: "list 0", 1: "list 1" } >>> dict {0: 'list 0', 1: 'list 1', 2: 'list 2'}In
sorted(mydict, key=lambda key: mydict[key]), how do I interpret or read the lambda? I don't understand that part since I'm new to lambdas. What doeskey:andmydict[key]refer to?In
sorted(d, key=d.get)what doesd.getrefer to? If I do:>>> dict.get <built-in method get of dict object at 0x1d27830>