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