Skip to content

Tag: python-3.x

Provide a file path or directory that contains files

I want to iterate through directories to find PDF files but I also want to be able to profile the file path without iterating through directories. So this is what I wrote: Answer Use os.path.isdir/os.path.isfile to check if the path is a valid directory/file. If it’s a directory – walk it with a f…