[Python] Get list of pdf files in folder

Discussão em 'Python' iniciado por Stack, Julho 15, 2025.

  1. Stack

    Stack Membro Participativo

    I want get a list of files name of all pdf files in folder I have my python script.

    Now I have this code:

    files = [f for f in os.listdir('.') if os.path.isfile(f)]
    for f in files:

    e = (len(files) - 1)


    The problem are this code found all files in folder(include .py) so I "fix" if my script is the last file on the folder (zzzz.py) and later I subtract the last file of the list that are my script.py.

    I try many codes for only find .pdf but this the more near I am.

    Continue reading...

Compartilhe esta Página