обавлены data.txt и script.py
This commit is contained in:
parent
cb21a725f6
commit
3b902bfc1a
4
python_env_practice/.gitignore
vendored
Normal file
4
python_env_practice/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
output.txt
|
||||||
3
python_env_practice/data.txt
Normal file
3
python_env_practice/data.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Иванов
|
||||||
|
Петров
|
||||||
|
Сидоров
|
||||||
8
python_env_practice/script.py
Normal file
8
python_env_practice/script.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
with open('data.txt', 'r', encoding='utf-8') as f:
|
||||||
|
lines = f.readlines()
|
||||||
|
|
||||||
|
with open('output.txt', 'w', encoding='utf-8') as f:
|
||||||
|
for line in lines:
|
||||||
|
f.write(line.strip().upper() + '\n')
|
||||||
|
|
||||||
|
print("Готово, результат в output.txt")
|
||||||
Loading…
Reference in New Issue
Block a user