How to list all files of a directory in Python

PHOTO EMBED

Saved by @bravocoder #python

import glob
print(glob.glob("/home/adam/*.txt"))
content_copyCOPY

Will return a list with the queried files: ['/home/adam/file1.txt', '/home/adam/file2.txt', .... ]

https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory