Python中的Dictionary类似于C++ STL中的Map
Sort by value
#remember to import
from operator import itemgetter
dict={.....}
#sort by value
sorted(dict.items(), key=itemgetter(1), reverse=True)
Sory by Key
#sort by key
sorted(d.items())[......]
Python中的Dictionary类似于C++ STL中的Map
Sort by value
#remember to import
from operator import itemgetter
dict={.....}
#sort by value
sorted(dict.items(), key=itemgetter(1), reverse=True)
Sory by Key
#sort by key
sorted(d.items())[......]