Hi there,
I’m quite new in Python. Kindly help me with exercises 16 and 17. For exercise 16, lines 1 - 8 runs smoothly, thereafter everything falls apart. Please see below:
PS C:\Users\code> python ex16.py test.txt
We’re going to erase test.txt.
If you don’t want that, hit CTRL-C (^C).
If you do want that, hit RETURN.
?
After pressing ‘enter’ I get the following problem.
Opening the file…
Traceback (most recent call last):
File “ex16.py”, line 12, in
target = open(filename, ‘w’)
PermissionError: [Errno 13] Permission denied: ‘test.txt’
PS C:\Users\code>
For exercise 17, lines 1 - 16 runs perfectly, and then it’s the same problem afterwards. Please see below:
PS C:\Users\code> python ex17.py test.txt new_file.txt
Copying from test.txt to new_file.txt
The input file is 68 bytes long
Ready, hit RETURN to continue, CTRL-C to abort.
I get the following after pressing ‘enter’
Traceback (most recent call last):
File “ex17.py”, line 16, in
out_file = open(to_file, ‘w’)
PermissionError: [Errno 13] Permission denied: ‘new_file.txt’
PS C:\Users\code>
Please note that I’m using Python 3.8, and Windows PowerShell.