python查找字符串出現(xiàn)次數(shù) 怎么用python統(tǒng)計字符串中每個字符出現(xiàn)的次數(shù)?
怎么用python統(tǒng)計字符串中每個字符出現(xiàn)的次數(shù)?STR=input(“please input a string of characters”)STR1=str.下()str2={}foriinst
怎么用python統(tǒng)計字符串中每個字符出現(xiàn)的次數(shù)?
STR=input(“please input a string of characters”)STR1=str.下()str2={}foriinstr1:str2[i]=str1.count(i)print(str2)
怎么用python統(tǒng)計字符串中每個字符出現(xiàn)的次數(shù)?
s=input().lower()result=[[e,s.count(e)]for e in set(list(s))]print(result)