Is there a way to list the files (not directories) in a directory with Python? I know I could use os.listdir and a loop of os.path.isfile()s, but if th
os.listdir
os.path.isfile()
Using pathlib, the shortest way to list only files is:
pathlib
[x for x in Path("your_path").iterdir() if x.is_file()]
with depth support if need be.