python统计大小写字符出现的个数

# -*- coding: utf-8 -*-
"""
Created on Wed Nov 15 20:54:50 2017


@author: 庸才
"""


a=input('请输入你的你要统计的字符串!')
for i in range(65,123):
    if a.count(chr(i))==0:
        continue;
    else:
        print(chr(i),":",a.count(chr(i)),end=' ')        

猜你喜欢

转载自blog.csdn.net/qq_37353105/article/details/78545451