Created
June 30, 2013 23:29
-
-
Save hexsprite/5897452 to your computer and use it in GitHub Desktop.
lowercase all dictionary keys recursively
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 lowerdictkeys(d): | |
| new = {} | |
| for k, v in d.iteritems(): | |
| if type(v) == type({}): | |
| v = lowerdictkeys(v) | |
| k = k.lower() | |
| new[k] = v | |
| return new | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment