When we print values in a dictionary, is there any default sorting that use to print the keys and values in a Python dictionary? Or do they randomly print the key , value pairs?
Please see below code. is there any order of dictionary value print in python?
confusion = {}
confusion[1] = 1
confusion[4] = 22
confusion['5'] = 2
confusion['2'] = 2
confusion[1.0] = 4
confusion['1'] = 2
print confusion
The result is {'2': 2, 1: 4, '1': 2, '5': 2, 4: 22}