import json
def f(**kwargs):
x = json.dumps(kwargs)
print x
print kwargs
f(b=4,**{"a":1})
'''
{"a": 1, "b": 4}
{'a': 1, 'b': 4}
'''
import json
def f(**kwargs):
x = json.dumps(kwargs)
print x
print kwargs
f(b=4,**{"a":1})
'''
{"a": 1, "b": 4}
{'a': 1, 'b': 4}
'''
本文标题:python. 函数传参
本文链接:https://www.haomeiwen.com/subject/odkrvhtx.html
网友评论