On 2007-09-16, Martin M. <[EMAIL PROTECTED]> wrote: > Hi everybody, > > Some of my colleagues want me to write a script for easy folder and > subfolder creation on the Mac. > > The script is supposed to scan a text file containing directory trees > in the following format: > > [New client] >|-Invoices >|-Offers >|--Denied >|--Accepted >|-Delivery notes
Would it make sense to store it like this? [('New client', [('Invoices', []), ('Offers', [('Denied', []), ('Accepted', [])]), ('Delivery notes', [])]] > First I thought of an array like this: > > dirtreedb = {'New client': {'Invoices': {}, 'Offers': {'Denied': {}, > 'Accpeted': {}}, 'Delivery notes': {}}} A dictionary approach is fine if it's OK for the directories to be unordered, which doesn't appear to be the case. > But this doesn't do the trick, as I also have to save the > hierarchy level of the current folder as well... The above does store the hierarchy, as the number of nesting levels. ditreedb['New Client']['Offers']['Denied'] -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list