[ad_1]
import re
with open("in1.txt") as f:
lines = f.read()
m = re.sub(r'(?s)my _car_.*?(?=my|$)', '', lines)
m = re.sub(r'\n+', '\n', m)
print m,
2
[ad_2]
solved Delete regex matching part of file
[ad_1]
import re
with open("in1.txt") as f:
lines = f.read()
m = re.sub(r'(?s)my _car_.*?(?=my|$)', '', lines)
m = re.sub(r'\n+', '\n', m)
print m,
2
[ad_2]
solved Delete regex matching part of file