I am opening a .tsv
file and changing its contents using some regexp:
with open("test.tsv") as tsvfile:
tsvreader = csv.reader(tsvfile, delimiter="\t")
for line in tsvreader:
#print(line[2])
match = re.search('(\w*[А-Я]\w*[А-Я]\w*)|(\d)|(%|$|€)', line[2])
if match:
print(line[2])
How can I save the modified contents to another .tsv
file?
Update: I need to save full line, not only line[2]