I think of dictionaries as an associative array, so when I typed
dict1 = {'first' : 1, 'second' : 2}
I was hoping when I call, it will be in the order in which it was written, but it is not. It was "second" to "first." I looked and realized that the dictionaries were disordered. So that makes sense, but I was wondering if there is a way to keep them in the same order that you wrote them (or added them)? All I'm looking for here is basically a list (which stays alright) that allows strings to be used as a key.
thanks
source share