#coding:utf-8 filename = input('please input a file name:') with open(filename) as f: text = f.read() for c in 'abcdefghijk': perc = 100*text.count(c)/len(text) print('{}-{}%'.format(c,round(perc,2)))
python統計文件中字母數量
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章