Calling C programs

Miki Tebeka miki.tebeka at zoran.com
Thu Mar 4 07:48:12 EST 2004


Hello Colin,

> I have a simple C program which outputs a string. I want to be able to call
> this progam from python and assign the output to a variable. What's the best
> way to do this?
from os import popen
print popen("/tmp/hello").read()

See http://www.python.org/doc/current/lib/os-process.html

HTH.
Miki



More information about the Python-list mailing list