> I have this python list that represets a sitemap:
>
> tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},
> {'indent': 1, 'title':'Item 2', 'hassubfolder':False},
> {'indent': 1, 'title':'Folder 1', 'hassubfolder':True},
> {'indent': 2, 'title':'Sub Item 1.1'
On Wed, 2010-06-30, Kushal Kumaran wrote:
> On Wed, Jun 30, 2010 at 2:04 PM, Nico Grubert wrote:
>> Dear list members
>>
>> I have this python list that represets a sitemap:
>>
>> tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},
>> {'indent': 1, 'title':'Item 2', 'hassubfolder
Nico Grubert wrote:
Use a stack?
Whenever you start a new list, push the corresponding closing tag onto
a stack. Whenever your "indent level" decreases, pop the stack and
write out the closing tag you get.
It's straightforward to use a python list as a stack.
Thanks for the tip, Kushal.
> Dear list members
>
> I have this python list that represets a sitemap:
>
> tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},
> {'indent': 1, 'title':'Item 2', 'hassubfolder':False},
> {'indent': 1, 'title':'Folder 1', 'hassubfolder':True},
> {'indent': 2
Use a stack?
Whenever you start a new list, push the corresponding closing tag onto
a stack. Whenever your "indent level" decreases, pop the stack and
write out the closing tag you get.
It's straightforward to use a python list as a stack.
Thanks for the tip, Kushal.
Do you have a short code
Nico Grubert, 30.06.2010 10:34:
I have this python list that represets a sitemap:
tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},
{'indent': 1, 'title':'Item 2', 'hassubfolder':False},
{'indent': 1, 'title':'Folder 1', 'hassubfolder':True},
{'indent': 2, 'title':'Sub Item 1.1', 'h
On Wed, Jun 30, 2010 at 2:04 PM, Nico Grubert wrote:
> Dear list members
>
> I have this python list that represets a sitemap:
>
> tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},
> {'indent': 1, 'title':'Item 2', 'hassubfolder':False},
> {'indent': 1, 'title':'Folder 1