s = input("请输入字符串") a = [] b = [] c = [] d = [] for i in s: if 'a'<=i<='z': a.append(i) if '1'<=i<='9': print(i) b.append(i) if i == ' ': c.append(i) print("字母个数:",len(a)) print("数字个数:",len(b)) print("空格个数:",len(c)) print("其他字符:",len(s)-len(a+b+c))
拓展