[Tutor] How to return a list in an exception object?

David Aldrich David.Aldrich at EMEA.NEC.COM
Thu Jun 18 12:31:55 CEST 2015


Thanks very much for all the answers to my question. I have taken the advice to return a list of differing files, rather than raise an exception.

I do have a follow-up question:

I have a list of paths that contain files I want to check. 

paths = [pathA, pathB]

then I check the files in each path and get a list of files that differ in some way:

for path in paths
    differing_files_list = compare_files(path)

I would like to store the differing_files_list with the associated path so that, after doing all comparisons, I can print the all differing files, sorted by path:

for path in paths
    for file in differing_files_list
        print(path + file)

How would I do that association?  I guess I need a two-dimensional list but I don't know how to build it.

Best regards

David



More information about the Tutor mailing list