python 从字符串中提取数字并求和

从字符串中提取数字 如从"i13love14you520"中提取出来 13,14,520,而后相加求和 方法1:git s = "i13love14you520" new_str = "" #建立一个空字符串 for ch in s: if ch.isdigit(): #字符串中的方法,能够直接判断ch是不是数字 new_str += ch else: new_str += "
相关文章
相关标签/搜索