Python:SyntaxError:关键字不能是表达式 [英] Python: SyntaxError: keyword can't be an expression

查看:131
本文介绍了Python:SyntaxError:关键字不能是表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Python脚本中,我从rpy2调用了一个函数,但出现此错误:

In a Python script I call a function from rpy2, but I get this error:

#using an R module 
res = DirichletReg.ddirichlet(np.asarray(my_values),alphas,
                              log=False, sum.up=False) 
SyntaxError: keyword can't be an expression

这里到底出了什么问题?

What exactly went wrong here?

推荐答案

sum.up不是有效的关键字参数名称.关键字参数必须是有效的标识符.您应该查看正在使用的库的文档,该库实际上是如何调用此参数 的-也许是sum_up?

sum.up is not a valid keyword argument name. Keyword arguments must be valid identifiers. You should look in the documentation of the library you are using how this argument really is called – maybe sum_up?

这篇关于Python:SyntaxError:关键字不能是表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆