fork download
  1. import re
  2. rx = r"(?:AppearanceTime\s+|^\d+\s+)(\d{2}:\d{2}:\d{2}|\d{2}\.\d{3})"
  3. s = ("AppearanceDate 29.08.2015\n"
  4. "AppearanceTime 00:02:18\n"
  5. "FrameCount 17\n"
  6. "# time bright x y alpha delta c_x c_y c_alpha c_delta use\n"
  7. "01 18.175 ---- 0.052 0.838 19.3755 21.947 ----- ----- -------- ------- no\n"
  8. "02 18.215 ---- 0.053 0.834 19.3682 21.985 ----- ----- -------- ------- no\n"
  9. "03 18.255 ---- 0.055 0.830 19.3608 22.024 ----- ----- -------- ------- no\n"
  10. "04 18.295 5.1 0.057 0.826 19.3535 22.063 ----- ----- 19.3541 22.070 yes\n"
  11. "05 18.335 0.4 0.058 0.821 19.3462 22.101 ----- ----- 19.3452 22.105 yes\n"
  12. "06 18.375 0.3 0.060 0.815 19.3354 22.137 ----- ----- 19.3365 22.140 yes\n"
  13. "07 18.415 0.3 0.061 0.811 19.3281 22.172 ----- ----- 19.3278 22.174 yes\n"
  14. "08 18.455 0.2 0.063 0.806 19.3193 22.210 ----- ----- 19.3192 22.208 yes\n"
  15. "09 18.495 0.2 0.064 0.801 19.3110 22.236 ----- ----- 19.3107 22.241 yes\n"
  16. "10 18.535 0.2 0.066 0.795 19.3018 22.286 ----- ----- 19.3023 22.274 yes\n"
  17. "11 18.575 0.1 0.068 0.791 19.2935 22.312 ----- ----- 19.2939 22.306 yes\n"
  18. "12 18.615 ---- 0.069 0.786 19.2861 22.335 ----- ----- -------- ------- no\n"
  19. "13 18.655 -0.1 0.070 0.782 19.2788 22.359 ----- ----- 19.2776 22.369 yes\n"
  20. "14 18.695 -0.1 0.071 0.776 19.2686 22.391 ----- ----- 19.2695 22.400 yes\n"
  21. "15 18.735 ---- 0.073 0.770 19.2583 22.424 ----- ----- -------- ------- no\n"
  22. "16 18.775 ---- 0.074 0.764 19.2480 22.456 ----- ----- -------- ------- no\n"
  23. "17 18.815 ---- 0.076 0.758 19.2383 22.488 ----- ----- -------- ------- no")
  24.  
  25. res = re.findall(rx, s, flags=re.MULTILINE)
  26. print(res)
  27.  
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
['00:02:18', '18.175', '18.215', '18.255', '18.295', '18.335', '18.375', '18.415', '18.455', '18.495', '18.535', '18.575', '18.615', '18.655', '18.695', '18.735', '18.775', '18.815']