上QQ阅读APP看书,第一时间看更新
Recursing through directories
In some cases, it is necessary to iterate recursively through the main directory to discover new directories. In this example, we see how we can browse a directory recursively and retrieve the names of all files within that directory:
import os
# you can change the "/" to a directory of your choice
for file in os.walk("/"):
print(file)