Calling a C program from a Python Script
Armin Steinhoff
a-steinhoff at web.de
Thu Dec 9 17:04:44 EST 2004
Brad Tilley 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:
>
> for root, files, dirs in os.walk(path)
> for f in files:
> try:
> EXECUTE_C_PROGRAM
>
> If possible, how much faster would this be over a pure Python solution?
I would compile that C program into a shared library (*.so or *.dll ) in
order to use that shared library with ctypes ... that's the easiest way,
IMHO :) ( http://starship.python.net/crew/theller/ctypes )
Regards
Armin
>
> Thank you,
>
> Brad
More information about the Python-list
mailing list