I'm doing this in Python 3.8 and I havent been able to fine a clean solution.
I am trying to remove any values from a nested dictionary if the value is equal to 0.
So the nested dictionary kinda looks like this:
{1: {"alert1" : 0, "alert2": 1, "alert3" : 3, "alert4": 1},
2: {"alert1" : 45, "alert2": 2, "alert3" : 0, "alert4": 54},
3: {"alert1" : 2, "alert2": 1, "alert3" : 33, "alert4": 11},
4: {"alert1" : 1, "alert2": 0, "alert3" : 2, "alert4": 0}}
And so if I want to print it or view it but only if an alert is not 0 so print(nested_dic) would look like this.
1 - alert2: 1 alert3: 3 alert4: 1
2 - alert1: 45 alert2: 2 alert4: 54
3 - alert1: 2 alert2: 1 alert3: 33 alert3: 11
4 - alert1: 1 alert3: 2
EDIT: Either delete the non zeroes or save a new dictionary without zeroes to be printed out.