python. 函数传参
2020-04-16 本文已影响0人
高峥
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}
'''