Does the python code
for key in dict:
...
, where dict
is a dict data type, always iterate in a fixed order with regrard to key
? For example, suppose dict={"aaa":1,"bbb",2}
, will the above code always first let key="aaa"
and then key="bbb"
(or in another fixed order)? Is it possible that the order is random? I am using python 3.3 in ubuntu 13 and let's assume this running environment doesn't change. Thank you.
add one thing: during multiple runs, the variable dict
remains unchanged, i.e., generate once and read multiple times.