with open(textinfo,'rb') as fp:
data=fp.read()
text=unicode(data,"gbk")
cnt=Counter()
for word in text:
cnt[word]+=1
cnt=dict(cnt)
L=sorted(cnt.items(),key = lambda x:x[1],reverse = True) #排序
L = L[:20] #前20个
dictdata = {}
for l in L:
print l[0],l[1]