disgrating a list

Diez B. Roggisch deets at nospam.web.de
Fri Sep 1 13:45:00 EDT 2006


jwaixs schrieb:
> Hello,
> 
> How can I disgrate (probably not a good word for it) a list? For
> example:
> 
> a = [1,2]
> b = 3
> c = [a] + [b]     # which makes [[1,2],3]

Why do you wrap a in a list? Just

c = a + [b]

will do it.

Diez



More information about the Python-list mailing list