Добавлены файлы data.txt, script.py
This commit is contained in:
parent
416d346c62
commit
1189541c00
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
venv/
|
||||
venv/
|
||||
output.txt
|
6
requirements.txt
Normal file
6
requirements.txt
Normal file
@ -0,0 +1,6 @@
|
||||
numpy==2.2.5
|
||||
pandas==2.2.3
|
||||
python-dateutil==2.9.0.post0
|
||||
pytz==2025.2
|
||||
six==1.17.0
|
||||
tzdata==2025.2
|
14
script.py
Normal file
14
script.py
Normal file
@ -0,0 +1,14 @@
|
||||
# script.py
|
||||
|
||||
# Открываем файл для чтения
|
||||
with open('data.txt', 'r', encoding='utf-8') as file:
|
||||
lines = file.readlines()
|
||||
|
||||
# Обрабатываем каждую строку — переворачиваем символы
|
||||
reversed_lines = [line.strip()[::-1] + '\n' for line in lines]
|
||||
|
||||
# Записываем обратно в новый файл
|
||||
with open('output.txt', 'w', encoding='utf-8') as file:
|
||||
file.writelines(reversed_lines)
|
||||
|
||||
print("Данные успешно обработаны и записаны в output.txt")
|
Loading…
Reference in New Issue
Block a user