Answers for "remove key from dictionary python if value empty"

1

python filter None dictionary

d = dict(a = 1, b = None, c = 3)

filtered = dict(filter(lambda item: item[1] is not None, d.items()))

print(filtered)
{'a': 1, 'c': 3}
Posted by: Guest on August-07-2020

Code answers related to "remove key from dictionary python if value empty"

Python Answers by Framework

Browse Popular Code Answers by Language