Can I convert a string to arguments list in python?
def func(**args): for a in args: print a, args[a] func(a=2, b=3) # I want the following work li
You can use the string as an argument list directly in an call to eval, e.g.
eval
def func(**args): for a in args: print( a, args[a]) s='a=2, b=3' eval('func(' + s + ')') >>>b 3 >>>a 2
note that func needs to be in the namespace for the eval call to work like this.
func