Well, it seems that Amos want to save this tree to file in human
readable format - in that case cPickle is not a solution, as well as
storing the whole list as is.
It also seems to me that the following format is simple and human
readable:
Root
Child
Child 2
Child that has sub-childs
Subchild1
Subchild2
Child 3
Child 4
Subchild
Sub-sub-child
(you show the nesting level with appropriate amount of spaces).
I also would suggest not to store Tree as a nested lists, but to write a
class. I've attached the example that I've just written which can write
itself to file and read itself from file. Enjoy ;).
Victor.
tree.py (3.35 KB)
···
----
Sincerely Yours, Victor V. Kryukov, UFG
phone: +7501 967 3727, ext. 4387
email: vkryukov@ufg.com
-----Original Message-----
From: Shi Sherebrin [mailto:shi@imaging.robarts.ca]
Sent: Tuesday, November 26, 2002 7:40 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] How to save the contents of a wxTreeCtrl
Amos Joshua wrote:
...
> too, what I'm thinking about is what
> format is the best one to save it to a file (which would be
easy to read
> too)? Maybe just write the list as it is; even though I
can't think of
How about using Python's pickle module? My understanding is
that's what
it was designed for...
Shi.
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwindows.org
Another option if you want human readable text representation of a nested
list would be to use yaml (yaml.org). It uses indentation to indicate
subobjects and looks a fair amount like what's below. (It also handles
dicts, ints, floats, strings and probably some other things).
-tim
···
----- Original Message -----
From: "Krjukov Victor" <VKryukov@ufg.com>
Well, it seems that Amos want to save this tree to file in human
readable format - in that case cPickle is not a solution, as well as
storing the whole list as is.
It also seems to me that the following format is simple and human
readable:
Root
Child
Child 2
Child that has sub-childs
Subchild1
Subchild2
Child 3
Child 4
Subchild
Sub-sub-child
(you show the nesting level with appropriate amount of spaces).
I also would suggest not to store Tree as a nested lists, but to write a
class. I've attached the example that I've just written which can write
itself to file and read itself from file. Enjoy ;).
Victor.
----
Sincerely Yours, Victor V. Kryukov, UFG
phone: +7501 967 3727, ext. 4387
email: vkryukov@ufg.com
-----Original Message-----
From: Shi Sherebrin [mailto:shi@imaging.robarts.ca]
Sent: Tuesday, November 26, 2002 7:40 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] How to save the contents of a wxTreeCtrl
Amos Joshua wrote:
...
> too, what I'm thinking about is what
> format is the best one to save it to a file (which would be
easy to read
> too)? Maybe just write the list as it is; even though I
can't think of
How about using Python's pickle module? My understanding is
that's what
it was designed for...
Shi.
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwindows.org
----------------------------------------------------------------------------
----
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org