SOLVED! I just found it out.... > 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)]
The following code solves the problem: >>> a = [(1,2,3), (4,5,6)] >>> b = [7,8] >>> a = map(tuple, map(lambda x: x + [b.pop(0)] , map(list, a))) >>> a [(1, 2, 3, 7), (4, 5, 6, 8)] Any more efficient ways or suggestions are still welcome! Greetings, Daniel -- http://mail.python.org/mailman/listinfo/python-list