def f1(p): # print(p) digit_num = 0 #数字 alpah_num = 0 #字母 space_num = 0 #空格 qita_num = 0 #其他 for i in p: if i.isdigit(): digit_num +=1 elif i.isalpha(): alpah_num += 1 elif i.isspace(): space_num +=1 else: qita_num += 1 return digit_num,alpah_num,space_num,qita_num ret = f1(' as5') print(ret)