标签:pytho ati join lis class strip lines alpha else
def frenquence_statistic(file_name): frequence = {} for line in open(file_name,‘r‘).readlines(): words =line.strip().split(" ") for word in words: word = ‘‘.join(list(filter(str.isalpha,word))).lower() if frequence.get(word) == None : frequence[word] = 1 else : frequence[word] +=1 print (frequence)
标签:pytho ati join lis class strip lines alpha else
原文地址:http://www.cnblogs.com/gforc/p/7466295.html