March 2003
Intermediate to advanced
656 pages
39h 30m
English
PyRun_String
PyObject* PyRun_String(char*astring,intstart, PyObject*globals,PyObject*locals)
Like PyRun_File, but the source code is in
null-terminated string astring.
Dictionaries locals and
globals are often new, empty dictionaries
(most conveniently built by Py_BuildValue("{}"))
or the dictionary of a module. PyImport_Import is
a convenient way to obtain an existing module object;
PyModule_GetDict obtains a
module’s dictionary. Sometimes you want to create a
new module object on the fly and populate it with
PyRun_ calls. To create a new, empty module, you
can use the PyModule_New C API function.
Read now
Unlock full access