Добавлены файлы data.txt, script.py

This commit is contained in:
Алексей Пастухов 2025-05-11 17:05:41 +03:00
parent bb0c6ee2bd
commit 0029646ffc
3 changed files with 14 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.venv/
output.txt

2
data.txt Normal file
View File

@ -0,0 +1,2 @@
чипсы 2
сухарики 4

11
script.py Normal file
View File

@ -0,0 +1,11 @@
with open('data.txt', 'r', encoding='utf-8') as file:
lines = file.readlines()
transformed_lines = [line.upper() for line in lines]
with open('output.txt', 'w', encoding='utf-8') as file:
for line in transformed_lines:
file.write(str(line) + '\n')
print("Файл output.txt успешно создан!")