[Tutor] Dictionary within a dictionary

Marilyn Davis marilyn at deliberate.com
Sat Jun 14 00:32:47 CEST 2008


On Fri, June 13, 2008 7:23 am, qsqgeekyogdty at tiscali.co.uk wrote:

> Hi,
> Following Alan's post, what I was trying to do is to understand how I
> can return the sub-item within the same space, if it makes sense ;)
>
> For example, in my 3 one-to-many lists, I want to generate this list:

When see nested builtin data structures, I always think it's time to think
of making a few classes instead.

Python tutors, is this a good suggestion?

Marilyn Davis

>
>
> [{'id': <group id>,
> 'category': [{'id': <category id>,
> 'sub-category': [ {'id': <sub-category id>,
> 'title': <sub-category title>,
> 'is_selected': <True | False>
> }
> ...]
> 'title': <category title>,
> 'is_selected': <True | False>
> }
> ...]
> 'title': <group title>,
> 'is_selected': <True | False>,
> }
> ...]
>
>
> Reason for this is that I want to create a navigational menu for a web
> template so that when you click on group_id the value is sent and this
> pulls the 'categories' and when you click on the category then the sub-
> categories are listed.
>
> Thanks
> David
>
>
>
>
> __________________________________________________________
>
>
> Find out what Tiscali can do for you - http://www.tiscali.co.uk/services
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor






More information about the Tutor mailing list