All you have to worry about is, you are getting value corresponding to the key or not and that is guaranteed by dict
.
d={"server":"mpilgrim", "database":"master", "uid":"sa", "pwd":"secret"}
for k, v in d.items():
print k, v
Output
pwd secret
database master
uid sa
server mpilgrim
Note: If you really want the order of the keys to be predictable, set PYTHONHASHSEED
environmental variable an integer value in the range [0,4294967295]
. Quoting from python --help
PYTHONHASHSEED: if this variable is set to 'random', the effect is the
same as specifying the -R option: a random value is used to seed
the hashes of str, bytes and datetime objects. It can also be set
to an integer in the range [0,4294967295] to get hash values with a
predictable seed.