list all file folder python code example
Example 1: list files in directory python
import os
print(os.listdir('/path/to/folder/to/list'))
Example 2: python dir all files
import os
for root, dirs, files in os.walk("."):
for filename in files:
print(filename)