Created
February 28, 2015 18:28
-
-
Save mjhea0/d746254e524f6e692773 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d1 = {'Name': 'John', 'Age': '25', 'DOB': None} | |
d2 = {'Name': 'ABC', 'Age': None, 'DOB': '10/20/1983'} | |
d2.update({key: value for key, value in d1.items() if value}) | |
print(d2) # => {'DOB': '10/20/1983', 'Age': '25', 'Name': 'John'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment