Seeing All of Your Nested Data
Joan’s port rejects four rows of the October export. The website volunteer wants each rejected row kept whole, so whoever corrects the export can see it. The debugging result now holds the month, the total and the rejected list, and each entry holds its line, the row (date, donor and amount) and the reason. Each row sits inside an entry, inside the list, inside the result.
In Python, the end of main() builds that result as a dictionary and prints it:
result = {
"month": "October",
"total": total,
"rejected": rejected,
}
print(result)
Python prints the whole result on one long line, every level included, down to each row’s date, donor and amount. The reasons are Python’s own messages.