One way is to define required replacements in dictionary, then iterate over rows in file, split row to words and replace if needed or keep and write to new file. I haven't tested it but something like this should work (this takes advantage of dict.get method where it is possible to provide default value when key is not found):
replacements = {"Verona": "Hellas Verona", "Sassuolu": "Sassuolu Calcio", "Monza": "AC Monza", "11.11%": "", "-1.11%": ""} with open("source.txt", "r") as source, open("output.txt", "w") as target: for line in source: print(" ".join(replacements.get(word, word) for word in line.split()), file=target)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.