Created
February 2, 2016 10:32
-
-
Save arisada/921f786d384b1e79873d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
from collections import namedtuple | |
def maketuple(name, params, data): | |
tclass=namedtuple(name, params) | |
d = tclass._make(data[i] for i in params.split(' ')) | |
return d | |
data = { | |
"a2":2, "a1":1, "a3":3 | |
} | |
print (maketuple("test", "a1 a2 a3", data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment