kovachev-bot/bulgarian-anagrams/reformat.py

12 lines
282 B
Python
Raw Permalink Normal View History

2023-09-01 17:12:08 +00:00
def process(line: str) -> str:
return line[line.rfind(" ")+1:].replace("-", "")
with open("words.txt") as f:
contents = f.readlines()
for i, line in enumerate(contents):
contents[i] = process(line)
with open("modified.txt", mode="w") as f:
f.writelines(contents)