Python remove dictionary key if value is empty


Here is a quick snippet if we want to remove dictionary key if value is empty:

1
new_dict = {k: v for k, v in _data.items() if v if v is not ”}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.