Написан скрипт на питоне по заданию 1 часть 3
This commit is contained in:
parent
6fc7146863
commit
2909e92a35
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.venv/
|
||||
.venv/
|
||||
output.txt
|
@ -1 +1,3 @@
|
||||
Задание по Python
|
||||
Задание по Python
|
||||
|
||||
Прочитать файл data.txt, поменять регистр букв и записать рещультат в output.txt
|
||||
|
16
script.py
Normal file
16
script.py
Normal file
@ -0,0 +1,16 @@
|
||||
def convert_case(text):
|
||||
return text.swapcase()
|
||||
|
||||
def main():
|
||||
with open('data.txt', 'r') as file:
|
||||
data = file.read()
|
||||
|
||||
converted_data = convert_case(data)
|
||||
|
||||
with open('output.txt', 'w') as file:
|
||||
file.write(converted_data)
|
||||
|
||||
print("Регистр букв изменён. Результат записан в output.txt")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Reference in New Issue
Block a user