Last active
April 5, 2021 16:57
-
-
Save svidgen/72169cd3b78add44a9640cb6e8a93eed to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def map_dict_leafs(d, f): | |
rv = {} | |
for k, v in d.items(): | |
if isinstance(v, dict): | |
rv[k] = map_dict_leafs(v, f) | |
else: | |
rv[k] = f(v) | |
return rv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment