[英]Include * in arguments to a function for python
I have a requirement to include * in arguments to a function. 我要求在函数的参数中包含*。 But it's syntactically wrong like below 但它在语法上是错误的,如下所示
>>> xr.bngConfig(get_topo*titan_file=self.inputs['titan_file'])
File "<stdin>", line 1
SyntaxError: keyword can't be an expression
I cannot change the argument here since bngConfig is calling a tcl function which has -get_topo*titan_file
as argument which I can't change. 我不能在这里更改参数,因为bngConfig正在调用一个tcl函数,它具有-get_topo*titan_file
作为参数,我无法更改。
How can * be included in python call? 如何*可以包含在python调用中?
xr.bngConfig(**{'get_topo*titan_file': self.inputs['titan_file']})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.