*bonk, bonk, bonk*

Now I feel better.

Thanks, everybody.   The "+" is indeed what I was looking for.    It just
didn't occur to me that this is the way you concatenate two lists together.
But of course, that makes sense, doesn't it?

Thanks again.


"Peter Hansen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> It's me wrote:
> > If I have:
> >
> >     a = (1,2,3)
>
> Note that this is a tuple.
>
> > how do I ended up with:
> >
> >     res=[(1), (2), (3), (4), (5)]
>
> Not that this is a list.  The two aren't the same thing.
> If you don't understand the difference, you might want
> to review the tutorial or head over to the tutor list.
>
> Also note that (1) is just the same as 1, so what you
> show above is the same as res=[1, 2, 3, 4, 5].  Is that
> what you wanted?
>
> > without doing:
> >
> >     res=[(a[0]), (a[1]), (a[2]), (4), (5)]
>
> Presumably what you are asking is how you can create
> a new list (or tuple?) based on the contents of the
> original tuple "a" but with two more elements added?
>
> This will do precisely what you've described, though
> it does convert "a" from a tuple into a list because
> you couldn't concatenate (join together) the two objects
> otherwise:
>
>     res = list(a) + [4, 5]
>
>
> -Peter


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to