-
-
Save clickyotomy/4a7df22843cd6e1e94c64a5baf1f39f5 to your computer and use it in GitHub Desktop.
Convert any dictionary to a named tuple
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
from collections import namedtuple | |
def convert(payload): | |
return namedtuple('GistDict', payload.keys())(**payload) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment