os.listdir(path) can return all the files under the directory of the given path. I an wonder if there exists any utility function that can conduct deep traverse and return all the paths of leaf files under a given directory.
Sure! You are looking for os.walk:
import os
for root, dirs, files in os.walk(path):
for filename in files:
filename = os.path.join(root, filename)
print(filename)