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

Discussion in 'Python' started by Dave Angel, Oct 25, 2012.

  1. Dave Angel

    Dave Angel Guest

    On 10/25/2012 05:16 AM, Dave Angel wrote:
    > On 10/25/2012 05:04 AM, inshu chauhan wrote:
    >> Actually what I wanted to do is :
    >>
    >> suppose there are 3 lists :
    >>
    >> like for xample :
    >>
    >> clist = [] an empty list , alist = [1,2,3], blist = [4,5,6]
    >>
    >> and the I want the result is clist = [ [1,2,3], [4,5,6] ..]
    >>
    >> then I want to read all the lists in clist one by one
    >>
    >> like :
    >>
    >> for item in clist:
    >> print item
    >>
    >> which should print:
    >>
    >> [1,2,3]
    >> [4,5,6]
    >>
    >>

    > clist = alist, blist
    >
    > or if the clist initial contents were relevant, perhaps you mean
    >
    > clist += alist, blist
    >
    >
    >


    Sorry, i was too quick off the mark. I meant

    clist = [alist, blist]

    my first response would work with the loop, but it would have been a
    tuple of lists



    --

    DaveA
     
    Dave Angel, 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,192
    HeidelbergMan
    Jul 6, 2007
  2. HYRY
    Replies:
    10
    Views:
    644
    Bruno Desthuilliers
    Sep 26, 2007
  3. dhruvbird
    Replies:
    16
    Views:
    1,394
    John Nagle
    Jul 16, 2010
  4. Daniel Fetchinson
    Replies:
    0
    Views:
    177
    Daniel Fetchinson
    Oct 23, 2012
  5. David Hutto
    Replies:
    0
    Views:
    183
    David Hutto
    Oct 25, 2012
Loading...

Share This Page