From db46cca4501aa0ca49838282ac462a3ee47b5c87 Mon Sep 17 00:00:00 2001 From: LuminoX Date: Tue, 28 Jan 2025 19:13:49 +0100 Subject: [PATCH] D0 tested --- TaskD00/taskD0.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/TaskD00/taskD0.py b/TaskD00/taskD0.py index 3cc9cae..5a6fe38 100644 --- a/TaskD00/taskD0.py +++ b/TaskD00/taskD0.py @@ -12,8 +12,9 @@ dictionary = { '8': 'i', '9': 'j', } +final = [] -with open('simple.in', encoding='utf8') as file: +with open('polish_wiki_excerpt.in', encoding='utf8') as file: lines = file.readlines() pattern = r'\d{4}' @@ -27,5 +28,10 @@ with open('simple.in', encoding='utf8') as file: for char in words: decoded_word += dictionary[char] line = line.replace(words, decoded_word, 1) - print(line) + final.append(line) + +with open('polish_wiki_excerpt.out', 'w', encoding='utf8') as file: + for line in final: + file.write(line + '\n') +