##########测试环境EPD7.0.2
from scipy.weave import inline
from scipy.weave import converters
def test():
x=list(range(10))
code = """
int i;
for (i=0; i < 10; i++)
{
x[i] = 1;
}
"""
inline(code, ["x"],type_converters=converters.blitz,compiler = 'gcc')
return x
x=test()
print x
####输出信息########################
#Found executable C:/Python27/Scripts/g++.exe
#[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
####输出信息########################
简单使用scipy.weave混合使用Python和C++代码的简单例子
最新推荐文章于 2024-04-10 18:45:35 发布
本文介绍了使用EPD7.0.2环境编写并执行Python代码片段的过程,实现了对列表元素的初始化操作,并通过代码输出了结果。详细展示了代码实现细节、编译过程及最终的输出结果。
7489

被折叠的 条评论
为什么被折叠?



