开发者

How to generate a `kwargs` list?

From an external file I generate the following dictionary:

mydict = { 'foo' : 123, 'b开发者_Python百科ar' : 456 }

Given a function that takes a **kwargs argument, how can generate the keyword-args from that dictionary?


def foo(**kwargs):
    pass

foo(**{ 'foo' : 123, 'bar' : 456 })
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜