list to tuple question

Gerhard Häring gh_pythonlist at
Fri Oct 5 14:52:18 CEST 2001

On Fri, Oct 05, 2001 at 04:35:25PM +0200, Janos Blazi wrote:
> I'd like to make a formatted string like this:
> s='%s %s %s %s %s %s %s %s %s\n' % (A,)+b+(C,D)
> The point is, that b is already a list and this would simplify matters. Most
> unfortunately (or most obviously for the initiated) I get the error message
> that a tuple and a list cannot be concatenated. What should I do. I could
> solve the problem by using a for-loop but is it necessary?

Concatenate lists: [A,]+b+[C,D]

mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

More information about the Python-list mailing list