字符串中匹配数字

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']

 

 
posted @ 2017-02-22 17:40  chen狗蛋儿  阅读(1269)  评论(0编辑  收藏  举报