|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
def edg(x):
english=0
number=0
block=0
others=0
length=len(x)
last=length-1
str1=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
str2=['0','1','2','3','4','5','6','7','8','9']
str3=[' ']
for each in range(last+1):
if x[each] in str1:
english+=1
continue
elif x[each] in str2:
number+=1
continue
elif x[each] in str3:
block+=1
continue
else :
others+=1
continue
return (english,number,block,others)
x=input('请输入字符串')
print(edg(x))
|
|