Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31931

Re: can we append a list with another list in Python ?

Date 2012-10-23 09:13 -0400
From Dave Angel <d@davea.name>
Subject Re: can we append a list with another list in Python ?
References <CAFqGZRHGgN_tEinBku9cj78D_VawZgP3F8k5+FKen0mW3AeVbg@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2664.1350998546.27098.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: can we append a list with another list in Python ? Dave Angel <d@davea.name> - 2012-10-23 09:13 -0400

csiph-web