SWIG / python数组内部结构

问题描述 投票:6回答:3

我在header.h内部定义了一个看起来像:

的结构
typedef struct {
....
    int      icntl[40];
    double   cntl[15];
    int      *irn, *jcn;
....

当我使用这种结构初始化对象时,我可以访问整数/双精度值,但不能访问数组。

>> st.icntl
<Swig Object of type 'int *' at 0x103ce37e0>
>> st.icntl[0]
Traceback (most recent call last):
  File "test_mumps.py", line 19, in <module>
    print s.icntl[0]
TypeError: 'SwigPyObject' object is not subscriptable

如何访问读/写中的值?

python arrays swig
3个回答
© www.soinside.com 2019 - 2024. All rights reserved.