3
votos
Aceito
Como executar uma função em todos os arquivos PDF de um diretório sem especificar o nome, python!
Pode usar a função pathlib.Path.glob:
from pathlib import Path
path = Path('.')
for file in path.glob('*.pdf'):
with file.open() as pdf:
...
Isso percorrerá todos os PDFs do diretório atual, ...
- 75,6mil
Only top scored, non community-wiki answers of a minimum length are eligible
Tags relacionadas
python-3.x × 3409python × 2256
django × 174
python-2.7 × 163
pandas × 160
lista × 139
tkinter × 120
string × 99
funções × 65
numpy × 45
regex × 44
opencv × 44
dicionário × 43
flask × 40
python-requests × 40
json × 39
matriz × 39
matplotlib × 38
orientação-a-objetos × 37
algoritmo × 37
pyqt-5 × 36
array × 35
loop × 35
selenium-webdriver × 35
django-templates × 33