Skip to content Skip to sidebar Skip to footer

How Would I Nest File Path Strings Into A List Based Upon Matching Folder Paths In Python

I just asked a similar question, however this is a bit different. This time I'm trying to basically create a nested file tree structure in a list. Lets say I have this list: files

Solution 1:

The os.walk builtin does what you want. You can play around with the output yourself to get it into the format you want.


Solution 2:

Resmar was correct, but I'll give some more detail as to how this was done. I asked a similar question after receiving his response and was given the correct answer here: https://stackoverflow.com/a/42031496/4043494

I'll post the actual code when I'm not on mobile.


Post a Comment for "How Would I Nest File Path Strings Into A List Based Upon Matching Folder Paths In Python"