DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
sort dict by value
d
=
{
'one'
:
1
,
'three'
:
3
,
'five'
:
5
,
'two'
:
2
,
'four'
:
4
}
a
=
sorted
(
d
.
items
(
)
,
key
=
lambda
x
:
x
[
1
]
)
print
(
a
)
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#sort
#dict
ADD COMMENT
Topic
COMMENT
Name
3+7 =
Submit