MCU單晶片韌體設計

2019年11月20日 星期三

[python] dict 依據value排序

不使用內建的sorted()函式, 例如

new_data=sorted(data.items(), key=lambda x: x[1],reverse=True) 


將dict依照value 進行排序 new_data=sort_dict_by_value(data,reverse=True)