标签:ems append def code default span color int python 基础
统计单词次数 作为字典存储
cotent = "who have an apple apple is free free is money you know" result = {} for s in content.split(""): if s in result: result[s] + =1 else: result[s] = 1 print result
反转上面的结果
res = {}
for k,v in result.items():
res.setdefault(v,[])
res[v].append(k)
标签:ems append def code default span color int python 基础
原文地址:http://www.cnblogs.com/guxiaobei/p/7751490.html