[Tutor] reading output from a c executable.

Ravi Kondamuru ravikondamuru at gmail.com
Thu Dec 11 19:29:10 CET 2008


I am expecting these lists to be huge and was hoping to avoid re-parsing in
python. Any way for the c program to return a list that python can directly
use.
Thanks for the pointer to json :) I am going to explore and evaluate
re-parsing overhead.
thanks,
Ravi.

On Thu, Dec 11, 2008 at 10:19 AM, bob gailer <bgailer at gmail.com> wrote:

> 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.
>>
>
> Funny that a C programmer is asking for pointers, when C has lots of
> pointers and Python has none. <chuckle>
>
> Python I/O reads strings. So you must encode the list in some manner into a
> string and decode it into a list in the Python program.
>
> Take a look as json. http://www.json.org/
>
> There are links to C and Python. You should be able there to findThats how
> to encode in C and decode in Python.
>
> You could "roll your own" encoding" but I think json would be easier.
>
> Remember to reply-all so a copy goes to the list.
>
> --
> Bob Gailer
> Chapel Hill NC 919-636-4239
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081211/b6ec2dce/attachment.htm>


More information about the Tutor mailing list