You are viewing a single comment's thread. Return to all comments →
import os, sys, re text = sys.stdin.read() pattern = r"(?<=\s)(&{2}|[|]{2})(?=\s)" def modified_match(match_object): if match_object.group() == '&&': return 'and' else: return 'or' text = re.sub(pattern, modified_match, text) print(os.linesep.join(text.splitlines()[1:])) #removes the line count at line n°1
Seems like cookies are disabled on this browser, please enable them to open this website
Regex Substitution
You are viewing a single comment's thread. Return to all comments →