上QQ阅读APP看书,第一时间看更新
Iterating over loose files
Recipe Difficulty: Easy
Python Version: 2.7 or 3.5
Operating System: Any
Often it is necessary to iterate over a directory and its subdirectories to recursively process all files. In this recipe, we will illustrate how to use Python to walk through directories and access files within them. Understanding how you can recursively navigate a given input directory is key as we frequently perform this exercise in our scripts.