[Tutor] [tutor] creating list of tuples
varsha.purohit at gmail.com
Tue Feb 26 05:09:45 CET 2008
I think i got it....
i m creating a tuple of 2 elements everytime and i m adding it to a list. i
m creating a new tup everytime and adding it to a list....
for x in file:
tup = ()
for developerAgent in developers:
tup = (value,globalVar.cntr)
i am getting output as what i described...
thanks for the help :)
On Mon, Feb 25, 2008 at 6:52 PM, Kent Johnson <kent37 at tds.net> wrote:
> Varsha Purohit wrote:
> > Hello all,
> > In my application i have to create a list of tuples. I have a for
> > loop which will create (x,y) tuple each time it iterates, and i ahve to
> > store each tuple in a list like
> > list1= [(x1,y1), (x2,y2).....]
> > any ideas how to do that ???
> list1 = 
> for ...
> # code to create x and y
> list1.append( (x, y) )
> Note you do need the double parentheses; the inner pair creates a tuple,
> the outer pair is for the function call.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor