fork download
  1. import re
  2. p = re.compile(r'(?m)^-{3,}$')
  3. t = "--------------------------------\nhello world !\n--------------------------------\nworld hello !\n--------------------------------\n! hello world"
  4. result = [x.strip() for x in p.split(t.strip("-\n\r"))]
  5. print(result)
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
['hello world !', 'world hello !', '! hello world']