p = 'output/article.md' a = open(p, encoding='utf-8').read() reps = [ (" For a small team, the real question is not whether the answers read well. It is how much checking they leave behind, and whether you can get access at all.", " For a small team, the real question is how much checking the answers leave behind, and whether you can get access at all."), (" That is everyone who has access right now.", ""), (" If you saw the lower figure, ignore it.", ""), (" LumenDesk has not published results for individual tasks, so nobody outside the company can check the number.", " No task-level results are published, so the number cannot be checked."), ("One wrong citation in six does not settle whether the product is good or bad. It does show that a correct answer with the wrong page reference still costs time, because someone has to find the right page before trusting it.", "One wrong citation in six settles nothing. But a correct answer with the wrong page still costs time, because someone has to find the right page."), (" A person still has to read the draft and act on it.", " A person still acts on it."), ] for old, new in reps: assert old in a, old a = a.replace(old, new) open(p, 'w', encoding='utf-8').write(a) print('ok')