I have a python script that keeps track of several directory names as individual variables. Some of these directories may exist, while others may need to be created at execution time.
For example, if I have this directory tree:
./top
/a
/a1
/a2
/b
/b1
/c
then I currently track all the directory path names with individual variables:
top_path = os.path.join(os.curdir, 'top')
a_path = os.path.join(top_path, 'a')
# etc...
but it would be nice to organise them in some way that respects the directory tree, if not actual OS directory support.
Is there some standard way of managing a directory tree (or any tree of variables) in python? Or should I just store everything in a nested list or tuple, or even make my own class? Something with a nice API like top.a.a1 returning './top/a/a1' would be great.