1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include <Python.h>
/* gcc -Wall -g -o demo demo.c -I/usr/include/python2.6 -L/usr/lib/python2.6/config -lpython2.6 -lnsl -ldl -lreadline -ltermcap -lieee -lpthread -lutil -lm -Xlinker -export-dynamic */
int main(int argc, char *argv[])
{
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n"
"print 'Wow we are actually in python right now!'\n");
Py_Finalize();
printf("Ok we are now back in C.\n");
return 0;
}
|