2016 - 2024

感恩一路有你

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

浏览量:1628 时间:2021-03-17 04:53:20 作者:admin

怎么用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)

python入门教程(非常详细) python统计字母出现个数 python统计某个字母出现次数

版权声明:本文内容由互联网用户自发贡献,本站不承担相关法律责任.如有侵权/违法内容,本站将立刻删除。