omega-rosetta
aien-dev/omega-rosetta
Brought by drakestapleton
omega-rosetta / tasks / strip-comments-from-a-string / oracle.py
| 1 | # Independent reference for "Strip comments from a string" (Python 3, standard library only). |
| 2 | # expected.txt is this program's stdout; omc never produced it. |
| 3 | import re |
| 4 | for s in ["apples, pears # and bananas", "apples, pears ; and bananas", " no comment here "]: |
| 5 | print("<<<" + re.split("[#;]", s, maxsplit=1)[0].strip(" \t") + ">>>") |