icount=input('请输入一行内容,包括,字母,数字,空格等\n') numbers=['0','1','2','3','4','5','6','7','8','9'] alphams=['a','b','c','d','e','f','g','h','i','g','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
numbersno=0 alphamno=0 spaceno=0 othersno=0
for inputdata in range(0,len(icount)): if icount[inputdata] in alphams: alphamno+=1 elif icount[inputdata] in numbers: numbersno+=1 elif icount[inputdata] ==' ': spaceno+=1 else: othersno+=1
print(alphamno,numbersno,spaceno,othersno)
注意:本文归作者所有,未经作者允许,不得转载