How to sort a python dictionary by value
If you want to search a dictionary by value in python, here is a handy one line using also lambda:
mydict = {'ver1':'2002','ver2':'2000','ver3':'2020'} dict_v_srt=sorted(mydict.items(),key=lambda sort_ver: sort_ver[1]) print dict_v_srt
If you run this script output will be ;
[('ver2', '2000'), ('ver1', '2002'), ('ver3', '2020')]