Python dictionary, how to keep keys/values in same order as declared? -


There was a question about new and dictionaries for Python, I had a dictionary that I had declared in a particular order And wanted to keep it all the time in that sequence.

So if I have a dictionary:

 

  D = {'AC': 33, 'GW': 20, 'AP': 102 , 'J': 321, 'BS': ​​10}  

In that sequence if I see it or repeat it, then there is no way to make sure That Python will keep the clear order that I have declared the keys / values?

The use of Python 2.6

  import from import Order ordered (for word in words, true)  

in

  orderdict ([([['' '' '' '' 'true' If 'value' is true, it is true that the value of 'true' is true, '' true '' ('ho', true), '' '', '' '' true '' ('winner', truth)]  

> (Or any other irreversible item), you can also use it:

  appears in the command. Framkiz (word, true)  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -