I populate a python dictionary based on several conditions.
My question is:
Is it possible to find a dictionary in the same order in which it is filled?
questions_dict={} data = str(header_arr[opt]) + str(row) questions_dict.update({data : xl_data}) valid_xl_format = 7 if (type.lower() == "ma" or type.lower() == "mc"): data = str(header_arr[opt]) + str(row) questions_dict.update({data : xl_data}) valid_xl_format = 7
After filling, if I iterate, this is not the order in which it is filled.
for k in questions_dict: logging.debug("%s:%s" %(k,questions_dict[k]))
source share