python-统计字符串中各字符的个数

'''
统计字符串中各字符的个数
'''
1 str = input("请输出字符串:")
2 dt = {}
3 for i in str:
4     dt[i] = str.count(i)
5 print(dt)

 

posted on 2022-02-21 21:16  Wuxuanlin  阅读(1426)  评论(0编辑  收藏  举报