Let's say a character string
"1977 1,048.20 1,039.40 894.10 694.70 664.20 1,031.60 928.60 18.80 10:27:05 "
How can I extract the numbers, i.e.
1977 1048.20 1039.40 894.10 694.70 664.20 1031.60 928.60 18.80 10 27 05
I can extract the numbers if this character string does not have comma to seperate the numbers. However no idea how to fetch them in the above case.
Below are my code for case that does not have a comma, which does not work for case that has a comma.
temperaturetime=re.findall(r'\d*\.?\d+',line)
Thank you, experts on python~
Aucun commentaire:
Enregistrer un commentaire