如何从C code unpickle [英] How to unpickle from C code
问题描述
我有一个Python code计算矩阵,我想用从C code这个矩阵(或数组或列表)。结果
我想咸菜从Python code中的矩阵,从C code unpickle它,但我无法找到如何做到这一点的文档或例子。
我发现了一些有关数据编组,但没有关于从C取储存。
I have a python code computing a matrix, and I would like to use this matrix (or array, or list) from C code.
I wanted to pickle the matrix from the python code, and unpickle it from c code, but I could not find documentation or example on how to do this.
I found something about marshalling data, but nothing about unpickling from C.
编辑:
评论者彼得·ħ问我是否与numpy的阵列工作。答案是肯定的。
Edit : Commenters Peter H asked if I was working with numpy arrays. The answer is yes.
推荐答案
如果它只是一个矩阵,你可以只写出来为CSV文件。看看这个Python的CSV模块。
http://docs.python.org/library/csv.html
If it's just a matrix, you could just write it out as a CSV file. Look at the Python csv module for this. http://docs.python.org/library/csv.html
这篇关于如何从C code unpickle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!