diff --git a/.gitignore b/.gitignore index 0cafc1c..c136cf9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.venv/ \ No newline at end of file +.venv/ +output.txt \ No newline at end of file diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..99a9952 --- /dev/null +++ b/data.txt @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0b17645 Binary files /dev/null and b/requirements.txt differ diff --git a/script.py b/script.py new file mode 100644 index 0000000..5caff65 --- /dev/null +++ b/script.py @@ -0,0 +1,19 @@ +# script.py + +def main(): + # 1. Открываем файл data.txt и считываем данные + with open("data.txt", "r", encoding="ANSI") as f: + lines = f.readlines() + + # 2. Преобразуем все строки в верхний регистр + upper_lines = [line.strip().upper() + "\n" for line in lines] + + # 3. Записываем результат в новый файл output.txt + with open("output.txt", "w", encoding="ANSI") as f: + f.writelines(upper_lines) + + print("Файл output.txt успешно создан.") + + +if __name__ == "__main__": + main() \ No newline at end of file