I’m want a function to return a list with directories with a specified path and a fixed depth and soon realized there a few alternatives. I’m using os.walk quite a lot but the code started to look ugly when counting the depth etc.
What is really the most “neat” implementation?
If the depth is fixed,
globis a good idea:Otherwise, it shouldn’t be too hard to use
os.walk: