Created
December 3, 2011 06:48
-
-
Save oinume/1426331 to your computer and use it in GitHub Desktop.
**つけるとdictオブジェクトをキーワード引数に変換できる
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 f(**kwargs): | |
for k, v in kwargs.iteritems(): | |
print "%s => %s" % (k, v) | |
f(**{ 'key1': 'value1', 'key2': 'value2' }) | |
# output: | |
# key2 => value2 | |
# key1 => value1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment