diff options
| author | Andrew <saintruler@gmail.com> | 2019-03-04 20:02:20 +0400 |
|---|---|---|
| committer | Andrew <saintruler@gmail.com> | 2019-03-04 20:02:20 +0400 |
| commit | 7e551b94d0b9bf10ae1def6123e1389962893a2f (patch) | |
| tree | 2a3f9d30d6844290d78fb4a2e197bd5db9c94881 /day1/task3 | |
| parent | cf734a68aeba34576d9bf5430aeaa75224010c67 (diff) | |
Day 1 Task 3
Diffstat (limited to 'day1/task3')
| -rw-r--r-- | day1/task3/task3.py | 18 |
1 files changed, 18 insertions, 0 deletions
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) |