merge list of tuples with list

Daniel Wagner brocki2301 at googlemail.com
Tue Oct 19 21:20:35 EDT 2010


On Oct 19, 8:35 pm, James Mills <prolo... at shortcircuit.net.au> wrote:
> On Wed, Oct 20, 2010 at 10:16 AM, Daniel Wagner
>
> <brocki2... at googlemail.com> wrote:
> > My short question: I'm searching for a nice way to merge a list of
> > tuples with another tuple or list. Short example:
> > a = [(1,2,3), (4,5,6)]
> > b = (7,8)
>
> > After the merging I would like to have an output like:
> > a = [(1,2,3,7), (4,5,6)]
>
> What happens with the 8 in the 2nd tuple b ?

Ohhhh, I'm sorry! This was a bad typo:
the output should look like:
a = [(1,2,3,7), (4,5,6,8)]

Greetings,
Daniel



More information about the Python-list mailing list