[Tutor] reading output from a c executable.

Steve Willoughby steve at alchemy.com
Thu Dec 11 19:27:22 CET 2008

Ravi Kondamuru wrote:
> Hi,
> I am writing a script to read list output from a C executable. How 
> should c program be written so that python can read the output as a list?
> Any pointers to info on this appreciated.

The possibilities are truly wide open on this.  Python can read a 
variety of standard formats (and of course can have custom code to read 
anything.  Depending on what the data involved actually are, you need to 
decide what format works best.

A simple approach is to have the C program write simple CSV output, and 
use Python's csv module to read it.  A more complex solution might be to 
use XML.  There are approximately 52,495,102 other possibilities 
available too, so you have lots of room to work out what's best for your 
  application.  More specific information on what you're trying to 
accomplish would help narrow it down as well.

More information about the Tutor mailing list