python 找出字符串的重复元素个数,并对字典进行倒序排序
#找出来各个元素在字符串中重复个数s='eeeyyyccceeeeejjjj'di={key:s.count(key) for key in set((s)) }print(di)#倒叙排序字典dic = sorted(di.items(),key=lambda key:key[1],reverse=True)print(dic)#dic现在是列表形式,转为字典格式,访问这...