On 22 May 08:44, CrabbyPete wrote:
> 
> 
> I am trying to make a selector in  a forms based on information in the
> database.
> 
> The selector uses a tuple like this:
> 
> PEOPLE = (('john','adams'),('sam','smith'),('john','doe'), ...)
> 
> if I start a tuple with ( ('john","adams"))
> 
> 
> 
> if I start with PEOPLE = (('john','adams')) how do I add the
> subsequent tuples?
> 
> I have tried  PEOPLE,('sam",smith) which works for the first one but
> the next add gives me
>  ((('john','adams'),('sam','smith')),('john','doe'))
> 
> 
> If I do this PEOPLE += ('john','doe') I get a string
> (('john','adams'),('sam','smith'),'john','doe' )
> 
> Could someone explain how I add tuples to tuples to get PEOPLE the way
> its supposed to be.

Tuples are immutable, use a list instead.

PEOPLE = [('john', 'adams'), ('sam', 'smith')]
PEOPLE.append(('john', 'doe'))

etc.

HTH,
-- 
Brett Parker

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to