__author__ = 'zhouhai'
#输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数
if __name__ == '__main__':
input_string = input("请输入字符串:")
character_list = list(input_string)
count_of_letter = 0
count_of_num = 0
count_of_space = 0
count_of_other = 0
for i in character_list:
if i.isdigit() == True:
count_of_num += 1
elif i.isalpha() == True:
count_of_letter += 1
elif i.isspace() == True:
count_of_space += 1
else:
count_of_other += 1
print("数字个数:%d"%(count_of_num))
print("字母个数:%d"%(count_of_letter))
print("空格个数:%d"%(count_of_space))
print("其他个数:%d"%(count_of_other))
#输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数
if __name__ == '__main__':
input_string = input("请输入字符串:")
character_list = list(input_string)
count_of_letter = 0
count_of_num = 0
count_of_space = 0
count_of_other = 0
for i in character_list:
if i.isdigit() == True:
count_of_num += 1
elif i.isalpha() == True:
count_of_letter += 1
elif i.isspace() == True:
count_of_space += 1
else:
count_of_other += 1
print("数字个数:%d"%(count_of_num))
print("字母个数:%d"%(count_of_letter))
print("空格个数:%d"%(count_of_space))
print("其他个数:%d"%(count_of_other))