Re: How to output a complex List object to a file.

2009-06-22 Thread Philip Semanchuk
On Jun 22, 2009, at 9:17 AM, Jim Qiu wrote: Hi all, I have a object list list this: from bots.botsconfig import * from D96Arecords import recorddefs from edifactsyntax3 import syntax structure=[ {ID:'UNH',MIN:1,MAX:1,LEVEL:[ {ID:'BGM',MIN:1,MAX:1}, {ID:'DTM',MIN:1,MAX:5}, ...snip...

Re: How to output a complex List object to a file.

2009-06-22 Thread J. Cliff Dyer
Have you looked at the JSON module? On Mon, 2009-06-22 at 21:17 +0800, Jim Qiu wrote: Hi all, I have a object list list this: from bots.botsconfig import * from D96Arecords import recorddefs from edifactsyntax3 import syntax structure=[ {ID:'UNH',MIN:1,MAX:1,LEVEL:[

Re: How to output a complex List object to a file.

2009-06-22 Thread Chris Rebert
On Mon, Jun 22, 2009 at 6:17 AM, Jim Qiubluefishe...@gmail.com wrote: Hi all, I have a object list list this: snip I need to output this structure object into a file, how to do that ? Links for the modules mentioned: http://docs.python.org/library/pickle.html

Re: Re: How to output a complex List object to a file.

2009-06-22 Thread bluefisher80
Let me get my question more clear, I want like the structure object printed into another python source file, which i will use in other program. The pickled format or even JSONed format does not fullfil my requirement, does it? Do i make it clear, I still need your guides. Jim Detail

Re: Re: How to output a complex List object to a file.

2009-06-22 Thread bluefisher80
Actually I think i am just looking for print myFile.py, myListObj 2009-06-23 bluefisher80 发件人: J. Cliff Dyer 发送时间: 2009-06-22 22:17:12 收件人: Jim Qiu 抄送: python-list 主题: Re: How to output a complex List object to a file. Have you looked at the JSON module? On Mon, 2009-06-22 at

Re: Re: How to output a complex List object to a file.

2009-06-22 Thread Chris Rebert
2009/6/22 bluefisher80 bluefishe...@gmail.com: Actually I think i am just looking for print myFile.py, myListObj Well, that syntax is deprecated. And you'd have to create the actual file object. And put it in a variable. So it's more like: f = file(myFile.py, w) f.write(str(myListObj))

Re: Re: Re: How to output a complex List object to a file.

2009-06-22 Thread Chris Rebert
On Mon, Jun 22, 2009 at 7:31 PM, bluefisher80bluefishe...@gmail.com wrote: Hi Thanks for you tip, I am generating some code for another python application, so is there a better way for code generating? Actually i just need to generate some list objects to define EDI syntax using python.