Is there any order of dictionary value print in python? -



Is there any order of dictionary value print in python? -

this question has reply here:

why python ordering dictionary so? [duplicate] 3 answers

when print values in dictionary, there default sorting utilize print keys , values in python dictionary? or randomly print key , value pairs?

please see below code. there 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 {'2': 2, 1: 4, '1': 2, '5': 2, 4: 22}

quoting documentation:

cpython implementation detail: keys , values listed in arbitrary order non-random, varies across python implementations, , depends on dictionary’s history of insertions , deletions.

python dictionary

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -