can we append a list with another list in Python ?

Dave Angel d at davea.name
Tue Oct 23 09:13:50 EDT 2012


On 10/23/2012 03:36 AM, inshu chauhan wrote:
> can we append a list with another list in Python ? using the normal routine
> syntax but with a for loop ??
>
>

To combine list a with list b, you can do any of:

c = a + b
a += b
a.extend(b)

Obviously, the first leaves a unmodified, while the other two modify it
in-place.



-- 

DaveA




More information about the Python-list mailing list