fork(1) download
  1. import re
  2. s= ''''abc' (17245...64590)
  3. 'cde' (12244...67730)
  4. 'dsa' complement (12345...67890)'''
  5. for m in re.finditer(r'\s{2,}(?:(\w+)\s*)?\(([\d.]+)\)', s):
  6. res = []
  7. if m.group(1):
  8. res.append(m.group(1))
  9. res.extend(re.findall(r'\d+', m.group(2)))
  10. print(", ".join(res))
Success #stdin #stdout 0s 23304KB
stdin
Standard input is empty
stdout
17245, 64590
12244, 67730
complement, 12345, 67890