软讯网络 > 编程语言 > 其他编程语言 > C中调用Python的示例
【标 题】:C中调用Python的示例
【关键字】:
Python
【来 源】:http://www.cublog.cn/u/8780/showart.php?id=179300
C中调用Python的示例
#include <Python.h>
int main(int argc, char *argv[])
{
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
Py_Finalize();
return 0;
}
编译的时候,加上-I -L参数