Skip to content

Instantly share code, notes, and snippets.

@hakjoon
Created October 20, 2015 14:04
Show Gist options
  • Save hakjoon/ef6b177b2b7fc6879bfd to your computer and use it in GitHub Desktop.
Save hakjoon/ef6b177b2b7fc6879bfd to your computer and use it in GitHub Desktop.
Filtered Dictionary without None values
def filtered_dict(d, keys):
return {key: d[key] for key in keys if d.get(key) is not None}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment