From 27e3dcfcfe01622276045878b77d30da89da5c3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D1=8E=D1=80=D0=BD=D0=B8=D0=BD=20=D0=9A=D0=B8=D1=80?= =?UTF-8?q?=D0=B8=D0=BB=D0=BB?= Date: Tue, 4 Mar 2025 21:59:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=B8?= =?UTF-8?q?=D0=BB,=20=D1=87=D1=82=D0=BE=20=D0=BD=D0=B5=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20output?= =?UTF-8?q?.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- data.txt | 6 ++++++ script.py | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 data.txt create mode 100644 script.py diff --git a/.gitignore b/.gitignore index 0cafc1c..c136cf9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.venv/ \ No newline at end of file +.venv/ +output.txt \ No newline at end of file diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..201d786 --- /dev/null +++ b/data.txt @@ -0,0 +1,6 @@ +сосиски +молоко +майонез +огурцы +помидоры +хлеб diff --git a/script.py b/script.py new file mode 100644 index 0000000..aa7be84 --- /dev/null +++ b/script.py @@ -0,0 +1,12 @@ +# script.py + +with open('data.txt', 'r', encoding='utf-8') as file: + lines = file.readlines() + +uppercase_lines = [line.strip().upper() for line in lines] + +with open('output.txt', 'w', encoding='utf-8') as output_file: + for line in uppercase_lines: + output_file.write(line + '\n') + +print("Данные успешно записаны в output.txt")