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 <[EMAIL PROTECTED]> 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 > >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor