python入门教程(非常详细) 怎么用python统计字符串中每个字符出现的次数?

怎么用python统计字符串中每个字符出现的次数?STR=input(“please input a string of characters”)STR1=str.下()str2={}foriinst

怎么用python统计字符串中每个字符出现的次数?

STR=input(“please input a string of characters”)STR1=str.下()str2={}foriinstr1:str2[i]=str1.count(i)print(str2)

怎么用python统计字符串中每个字符出现的次数?

s=input().lower()result=[[e,s.count(e)]for e in set(list(s))]print(result)