Загрузить файлы в «/»
This commit is contained in:
commit
4b9f07a09a
4
output.txt
Normal file
4
output.txt
Normal file
@ -0,0 +1,4 @@
|
||||
ЙОГУРТ
|
||||
КУРОГРУДКА
|
||||
ОГУРЦЫ
|
||||
ТВОРОГ
|
13
script.py
Normal file
13
script.py
Normal file
@ -0,0 +1,13 @@
|
||||
# Открываем data.txt и читаем содержимое
|
||||
with open("data.txt", "r", encoding="utf-8") as file:
|
||||
lines = file.readlines()
|
||||
|
||||
# Преобразуем данные: переводим в верхний регистр и сортируем
|
||||
processed_lines = sorted(line.strip().upper() for line in lines)
|
||||
|
||||
# Записываем результат в output.txt
|
||||
with open("output.txt", "w", encoding="utf-8") as file:
|
||||
for line in processed_lines:
|
||||
file.write(line + "\n")
|
||||
|
||||
print("Файл output.txt успешно создан!")
|
Loading…
Reference in New Issue
Block a user