fork download
  1. import re
  2.  
  3. regex = r"(\d+\.\d+)(?: \1)*"
  4. test_str = "46016.0000000 46016.0000000 46016.0000000 46016.0000000 46016.0000000 46019.0000000 46019.0000000 46019.0000000 46019.0000000 46019.0000000 46015.0000000 46015.0000000 46015.0000000 46015.0000000 46015.0000000 46016.0000000 46016.0000000 46016.0000000 46016.0000000 46016.0000000 46019.0000000 46019.0000000 46019.0000000 46019.0000000 46019.0000000 46015.0000000 46015.0000000 46015.0000000 46015.0000000 46015.0000000 46016.0000000 46016.0000000 46016.0000000 46016.0000000 46016.0000000"
  5. matches = re.finditer(regex, test_str, re.MULTILINE)
  6. new_list = []
  7.  
  8. for matchNum, match in enumerate(matches, start=1):
  9. new_list.append(match.group().split(" "))
  10.  
  11. print(new_list)
Success #stdin #stdout 0.02s 9524KB
stdin
Standard input is empty
stdout
[['46016.0000000', '46016.0000000', '46016.0000000', '46016.0000000', '46016.0000000'], ['46019.0000000', '46019.0000000', '46019.0000000', '46019.0000000', '46019.0000000'], ['46015.0000000', '46015.0000000', '46015.0000000', '46015.0000000', '46015.0000000'], ['46016.0000000', '46016.0000000', '46016.0000000', '46016.0000000', '46016.0000000'], ['46019.0000000', '46019.0000000', '46019.0000000', '46019.0000000', '46019.0000000'], ['46015.0000000', '46015.0000000', '46015.0000000', '46015.0000000', '46015.0000000'], ['46016.0000000', '46016.0000000', '46016.0000000', '46016.0000000', '46016.0000000']]