Introduction to Generator Expressions in Python
“It always seems impossible until it’s done.” - Nelson Mandela
Filter a list of empty dictionaries in Python
Using filter
function and lambda expression, then get first element of the list.
filter_table = [d for d in table if any(d.values())]
filter_table2= list(filter(lambda d: any(d.values()), table))
row = filter_table2[0] if filter_table2 else None
–HTH–