-1

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.

Khach R
  • 1
  • 1
  • Hi there and welcome to SOF! From your question it's quite unclear what you are looking for? A way to read a pdf? A way to iterate code over files? Please elaborate so we can help you better. Also, how did you try to solve this problem so far? What options did you explore? – barshopen Jan 18 '21 at 13:32
  • Hey, Yes I tried some ways and found the below solution I posted as an answer. Thank you for showing interest in answering. – Khach R Jan 19 '21 at 11:55

1 Answers1

0

$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
    
Khach R
  • 1
  • 1