Skip to content

Instantly share code, notes, and snippets.

@sdvcrx
Created December 9, 2014 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdvcrx/53bad475ab257c8db09b to your computer and use it in GitHub Desktop.
Save sdvcrx/53bad475ab257c8db09b to your computer and use it in GitHub Desktop.
把重复数字出现的次数按从多到少排列打印出来
from collections import Counter
num = "135481963636"
n = Counter(num)
for key, freq in n.most_common():
print("{0}: {1}".format(key, freq))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment