求输入一串字符串中的数字和

# str1 = input()
# s = 0
# for i in str1:
#     if i.isdigit():
#         s += int(i)
# print(s)


str2 = input()
str3 = ""
for i in str2:
    if i.isdigit():
        str3 += i
    else:
        str3 += " "
list1 = str3.split()
s = 0
for i in list1:
    s += int(i)
print(s)



猜你喜欢

转载自blog.csdn.net/feiYu12138/article/details/81773013