forked from stud179125/Together_Project
20 lines
744 B
Python
20 lines
744 B
Python
# script.py
|
||
try:
|
||
# Чтение данных с указанием кодировки
|
||
with open('data.txt', 'r', encoding='utf-8') as f_in:
|
||
lines = [line.strip() for line in f_in.readlines()]
|
||
|
||
# Преобразование с учётом русских букв
|
||
processed_data = [line.upper() for line in lines]
|
||
|
||
# Запись с сохранением кириллицы
|
||
with open('output.txt', 'w', encoding='utf-8') as f_out:
|
||
f_out.write('\n'.join(processed_data))
|
||
|
||
print("Данные обработаны! Результат в output.txt")
|
||
|
||
except FileNotFoundError:
|
||
print("Ошибка: Файл data.txt не найден!")
|
||
except Exception as e:
|
||
print(f"Ошибка: {str(e)}")
|