[Easy python] loop through files in directory
If you want to loop through files in a directory you can use the os module and its function listdir(path). For example, runnable python script and directory are in the same directory, if you need to check files from another directory you need to specify an absolute path.
import os
for filename in os.listdir('test_directory'):
print(filename)
Output:
test_file.py my_file.py text_file.txt