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

Discussion in 'Python' started by David Hutto, Oct 25, 2012.

  1. David Hutto

    David Hutto Guest

    On Thu, Oct 25, 2012 at 5:31 AM, Dave Angel <> wrote:
    > On 10/25/2012 05:21 AM, inshu chauhan wrote:
    >>>
    >>> or if the clist initial contents were relevant, perhaps you mean
    >>>
    >>>> clist += alist, blist
    >>>

    >>
    >> But not this because it will simply concatenate the list like
    >> [1,2,3,4,5,6] .. I dont want this actaully...
    >>
    >>>

    >
    > No, it won't. Try it to see.
    >


    Is this what you mean:

    >>> list_1 = [i for i in range(0,5)]
    >>> list_2 = [i for i in range(5,11)]
    >>> for i in list_2:

    .... list_1.append(i)
    ....
    >>> list_1

    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]


    or would another example help you out more?

    --
    Best Regards,
    David Hutto
    CEO: http://www.hitwebdevelopment.com
     
    David Hutto, Oct 25, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. June Moore

    Append one array to another array

    June Moore, Oct 28, 2004, in forum: Java
    Replies:
    20
    Views:
    68,198
    HeidelbergMan
    Jul 6, 2007
  2. HYRY
    Replies:
    10
    Views:
    647
    Bruno Desthuilliers
    Sep 26, 2007
  3. dhruvbird
    Replies:
    16
    Views:
    1,395
    John Nagle
    Jul 16, 2010
  4. Daniel Fetchinson
    Replies:
    0
    Views:
    177
    Daniel Fetchinson
    Oct 23, 2012
  5. Dave Angel
    Replies:
    0
    Views:
    192
    Dave Angel
    Oct 25, 2012
Loading...

Share This Page