What sort of data structure to use?

David Aldrich David.Aldrich at EMEA.NEC.COM
Wed Jun 3 04:19:23 EDT 2015


Hi

I have written a Python utility that performs a certain activity on some predefined sets of files.  Here is the outline of what I have written:

# File Set A
pathA = 'pathA'
fileListA = ['fileA1.txt', 'fileA2.txt']

# File Set B
pathB = 'pathB'
fileListB = ['fileB1.txt', 'fileB2.txt', 'fileB3.txt']

myFunc1(pathA, fileListA)
myFunc2(pathA, fileListA)

myFunc1(pathB, fileListB)
myFunc2(pathB, fileListB)

I want to add more file sets, so I really want to add the sets to a list and iterate over the list, calling myFunc1 & myFunc2 for each item.

My question is: what sort of data structure could I use to organise this, given that I want to associate a set of files with each path and that, for each set, there is an arbitrary number of files?

Best regards

David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150603/41236d73/attachment.html>


More information about the Python-list mailing list