I have nested dictionary as following:
Dict1 | level 1-1 | level 2-1-1 | level 3-1-1-1 | core [1]
| core [2]
| core [3]
| level 3-1-1-2 | core [1]
| core [2]
| level 2-1-2 | level 3-1-2-1 | core [1]
| core [2]
| level 3-1-2-2 | core [1]
| level 1-2 | level 2-2-1 | level 3-2-1-1 | core [1]
| level 3-2-1-2 | core [1]
| level 2-2-2 | level 3-2-2-1 | core [1]
| core [2]
| level 3-2-2-2 | core [1]
..........
level 1 would be my key level 2 would be my key1 level 3 would be my key2 core would be my value2 for key2 core and level 3 would be my value1 for key1 core, level 3, and level 2 would be my value for key
When the script was executed, there were some errors, specifically KeyError of key2. I came up with couple lines to put this exception to a log.txt file. ie:
except KeyError:
save_to_log (time_stamp, sys.exc_info()[0], sys.exc_info()[1])
continue
However, it can only output the key2 information. I would like to be able to output the key information in respect to the key2 so that I can easily identify the fault in the original file. Is this possible in Python? Any suggestion is greatly appreciated. Thanks in advance.
bookstore = {}; bookstore[book,chapter,paragraph] = "blah". This vastly simplifies this sort of thing.