str1 = input("请输入任意字符串: ") list1= [] #存储字符串 list2= [] #存储数字 for i in str1: if i.isdigit() == True: #判断当前字符是否为字符 list2.append(int(i)) else: list1.append(i.upper()) print(list2) print(list1)
str1 = input("请输入任意字符串: ") list1= [] #存储字符串 list2= [] #存储数字 for i in str1: if i.isdigit() == True: #判断当前字符是否为字符 list2.append(int(i)) else: list1.append(i.upper()) print(list2) print(list1)