I have created a small python script. With that I am trying to read a txt file but my access is denied resolving to an no.13 error, here is my code:
import time
import os
destPath = 'C:\Users\PC\Desktop\New folder(13)'
for root, dirs, files in os.walk(destPath):
f=open(destPath, 'r')
.....
Based on the name, I'm guessing that destPath
is a directory, not a file. You can do a os.walk
or a os.listdir
on the directory, but you can't open
it for reading. You can only call open
on a file.
Maybe you meant to call open
on one or more of the items from files