Python. Order of keys in dictionary. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python. Order of keys in dictionary.

I have to print keys of dictionary in right order, but I can get only random order. Can you give me some advices? https://code.sololearn.com/ccUpNDk4Pyav/?ref=app https://code.sololearn.com/ccUpNDk4Pyav/?ref=app

19th Dec 2017, 1:04 PM
Непряхин Даниил
Непряхин Даниил - avatar
2 Answers
+ 10
Yes, an ordered dict may be what you are looking for. https://code.sololearn.com/cBUNKDVhCC5Z/?ref=app
25th Dec 2017, 12:59 PM
Eric Blinkidu
Eric Blinkidu - avatar
+ 2
I can use collections.OrderedDict https://code.sololearn.com/ckFGMZXAt5pL/?ref=app
19th Dec 2017, 1:17 PM
Непряхин Даниил
Непряхин Даниил - avatar