def reverse_file_content(input_file, output_file): try: with open(input_file, 'r', encoding='utf-8') as file: content = file.read() reversed_content = content[::-1] with open(output_file, 'w', encoding='utf-8') as file: file.write(reversed_content) print(f"Файл успешно перевернут и сохранен как '{output_file}'") except FileNotFoundError: print("Ошибка: исходный файл не найден") except Exception as e: print(f"Произошла ошибка: {e}") # Пример использования reverse_file_content('data.txt', 'output.txt')