Created
April 17, 2012 21:07
-
-
Save aperson/2409055 to your computer and use it in GitHub Desktop.
Ways to pull out a value from a dict case insensitively
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
def ids (t, d): | |
for i in d.keys(): | |
if re.match(r'^{}$'.format(t), i, re.I): | |
return d[i] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment