This is a job to search.
find /stuff -type d -exec script.py {} +
When you use -exec , the curly braces {} are replaced with the names of the matching files, and + indicates the end of the command (in case you want to tell find to do additional things). This is an ideal way to execute a command with find, as it will handle file names with unusual characters (e.g. spaces) correctly.
find is quite flexible, especially if you have a version of GNU that usually ships with Linux distributions.
In the second example, note the careful use of \0 and xargs -0 to use the NUL character to delimit file names. It may seem strange, but it allows the team to work, even if you are doing something really strange, like using newlines \n in the names of your directories.
Alternatively, you can do this using only the built-in shells. I do not recommend this, but for educational value, here's how:
John kugelman
source share