import re string="A1.45,b5,6.45,8.82" print(re.findall(r"\d+\.?\d*",string)) # r"\d+\.?\d*" \d+ 匹配一个或多个数字; \.? 匹配.一次或零次; \d* 匹配零个或多个数字
# ['1.45', '5', '6.45', '8.82']