using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 合并字典 { class Program { static void Main(string[] args) { Dictionary<int, string> dicA = new Dictionary<int, string> {
场景:词频统计时候,我们往往要对频率进行排序 sorted(iterable,key,reverse),sorted一共有iterable,key,reverse这三个参数.其中iterable表示可以迭代的对象,例如可以是dict.items().dict.keys()等,key是一个函数,用来选取参与比较的元素,reverse则是用来指定排序是倒序还是顺序,reverse=true则是倒序,reverse=false时则是顺序,默认时reverse=false. 已知: >>> a