Social Reiot

Social Game Developer wandering in strange dungeon.

Python Dictionary 를 값으로 정렬해서 최대값을 가진 키를 ...

python dictionary 를 값으로 정렬해서 최대값을 가진 키를 찾기. d = { x:1, y:2, z:3 } l = d.items() l.sort( key=lambda x: x[1] , reverse=True ) print l[0][0] http://code.activestate.com/recipes/304440-sorting-dictionaries-by-value-in-python-24/

Comments