I'm new to Python and having an issue with defaultdict. I have some json, where the lastInspection key isn't always present. I need to put a default value in for the date.
p.get("lastInspection", "")
returns me {'date': '2018-01-03'}
problem = [{'lastInspection': {'date': '2018-01-03'}, 'contacts': []}]
for p in problem:
print(p.get("lastInspection", ""))
print(p.get("date", ""))