python中统计一个字母出现的次数

如题所述

a = input("请输入字符串:")
b = list(a.lower()) #将输入的字符全部转换为小写字母
c = {} #建立一个空字典
for i in b: #for循环遍历出结果
c[i] = b.count(i)
print(c)

输出结果:

温馨提示:答案为网友推荐,仅供参考
相似回答