Tuesday, July 24, 2018

How to extract all numbers / floats from a string with python regex

import re

stringWithNumbers='anystring2with 6.89 numbers3.55 3.141312'
digits = re.findall("[-+]?\d+\.?\d*", stringWithNumbers)

No comments:

Post a Comment