I need to parse the numeric values from a string that is not well formatted. Example:
"0 0 .1 .05 .05 0. 0. .01"
or
"0,0,.1,.05,.05,0.,0.,.01"
As you can see the delimiter can vary from several spaces to commas with no spaces. Also, the numbers may be ints or floats. I would like to split on any number of consecutive spaces, tabs, and commas. I thought I could do this with the str.split() function, however I found that it only works with one delimiter argument and will not do commas by default.
Does anyone know a clever way to do this? Possibly with regular expressions?
Thanks in advance.