import os files_and_directories = os.listdir("path/to/directory")

get files in directory python

from pathlib import Path for txt_path in Path("/path/folder/directory").glob("*.txt"): print(txt_path)

python get files in directory

Similar Code Examples