统计全部字符出现次数 使用collections中的Counter from collections import Counter st="sjdfhsdkfshdfjkgafdha" print(Counter(st)) 统计单个字符出现次数 使用count统计单个字符出现次数 st="sjdfhsdkfshdfjkgafdha" print(st.count('a')) 来源:CSDN作者:Angryshark_128链接:https://blog.csdn.net/weixin_42078760/article/details/103881837 标签 字符统计 python字符串