我正在使用ZEEP连接到NetSuite。创建发票时需要传递给NS的参数之一是“class”。如果我理解正确的话,下面这行代码没有编译的原因是因为'class'是一个保留关键字。在
invoice = invoiceType(
customFieldList = customFieldList,
entity = entityRecord,
subsidiary = subRecord,
department = departmentRecord,
location = locationRecord,
class = classRecord
)
我不能选择将最后一个参数从say'class'改为'class'或其他东西,因为这正是NetSuite期望参数被调用的地方。我可以在python中使用其他方法吗?有没有一种方法可以在将其作为参数传递时进行转义?在
您需要使用
**{...}
语法来传递名称为保留字的关键字参数。在它所做的是用一个名为
'class'
的键创建一个字典,然后将字典展开为一个参数,这样就不必指定字面的class
关键字。在相关问题 更多 >
编程相关推荐