Decided to start my own thread rather than hijack thread "Sorting"
I followed ghostdog74 advice and used module re to extract numeric strings:
import re
data_raw = """[20]
[ 35+ ]
age = 40
(84)
100kg
$245
"""
# use regex module re to extract numeric string
data_list = re.findall(r"\d+",data_raw)
print data_list # ['20', '35', '40', '84', '100', '245']
That works fine, but when I change to floating point number:
import re
data_raw = """[20]
[ 35+ ]
age = 40
(84)
100kg
$245.99
"""
# use re to extract numeric string (however, float split at '.')
data_list = re.findall(r"\d+",data_raw)
print data_list # ['20', '35', '40', '84', '100', '245', '99']
How can I make re handle floating point numbers?