Calling a C program from a Python Script
grante at visi.com
Thu Dec 9 19:19:36 CET 2004
On 2004-12-09, Brad Tilley <bradtilley at gmail.com> wrote:
> Is it possible to write a file open, then read program in C and then
> call the C program from a Python script like this:
Huh? What do you mean "write a file open"? You want to read a
C source file and execute the C source? If you have access to
a C interpreter, I guess you could invoke the interpreter from
python using popen, and feed the C source to it. Alternatively
you could invoke a compiler and linker from C to generate an
executable and then execute the resulting file.
> for root, files, dirs in os.walk(path)
> for f in files:
You're going to have to explain clearly what you mean by
"EXECUTE_C_PROGRAM". If you want to, you can certainly run a
binary executable that was generated from C source, (e.g. an
ELF file under Linux or whatever a .exe file is under Windows).
> If possible, how much faster would this be over a pure Python
Solution to what?
Grant Edwards grante Yow! And furthermore,
at my bowling average is
More information about the Python-list