For python, is there any common data structure for representing the tree in the file system in all OSs?
I currently use a dictionary and store the tree in this way.
C/
├─ C1
├─ C3/
│ ├─ C31
tree =
{"title": "root",
"child": [
{"title": "C",
"child": [{"title": "C1"
},
{"title": "C3",
"child": [
{"title": "C31"
}
]
}
]
}
]}
however, this naive way lacks a lot of functions, such as comparing two trees, calculating a number of files, etc.
Is there any package that could do these functions and have a data structure specifically dealing with folder and file trees?