From 7e551b94d0b9bf10ae1def6123e1389962893a2f Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 4 Mar 2019 20:02:20 +0400 Subject: Day 1 Task 3 --- day1/task3/task3.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 day1/task3/task3.py (limited to 'day1/task3/task3.py') diff --git a/day1/task3/task3.py b/day1/task3/task3.py new file mode 100644 index 0000000..a456af9 --- /dev/null +++ b/day1/task3/task3.py @@ -0,0 +1,18 @@ +import os + + +file_path = input() + +if os.access(file_path, os.W_OK): + os.remove(file_path) +else: + with open(file_path, 'w', encoding='utf-8') as f: + f.write('Ало здравствуйте. Alo zdravstvuite.') + + with open(file_path, 'w', encoding='windows-1251') as f: + print(f.read()) + + with open(file_path, 'w', encoding='utf-8') as f: + print(f.read()) + + os.remove(file_path) -- cgit v1.2.3