interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / tasks / strip-comments-from-a-string / oracle.py

5 lines · 339 bytes Raw Blame History
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.
3import re
4for s in ["apples, pears # and bananas", "apples, pears ; and bananas", " no comment here "]:
5 print("<<<" + re.split("[#;]", s, maxsplit=1)[0].strip(" \t") + ">>>")