Run a Python pgm for multiple PDF

37 Views Asked by At

I have a program exp.py which provides a yes/no result. I want to know how to run the script for multiple PDF and capture the output.

example input: xyz.pdf, abc.pdf, mno.pdf ;

1.output:

  • xyz yes
  • abc no
  • mno yes

Please advice.

1

There are 1 best solutions below

0
On

$I did some research and found the below solution with Glob library. hope the below $solution helps.

path = "C:/Users/documents/*.*"
i=0
for file in glob.glob(path):
    pdf_file = fitz.open(file)
    print(glob.glob(os.path.basename(path))[i])
    i=i+1