<br>Actually what I wanted to do is : <br><br>suppose there are 3 lists :<br><br>like for xample : <br><br>clist = [] an empty list , alist = [1,2,3], blist = [4,5,6]

<br><br>and the I want the result is clist = [ [1,2,3], [4,5,6] ..] <br><br>then I want to read all the lists in clist one by one <br><br>like : <br><br> for item in clist:<br>     print item <br><br>which should print:<br>
<br>[1,2,3]<br>[4,5,6]<br><br><br><br><br><div class="gmail_quote">On Tue, Oct 23, 2012 at 10:10 PM, inshu chauhan <span dir="ltr"><<a href="mailto:insideshoes@gmail.com" target="_blank">insideshoes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ok I got it guys...<div class="HOEnZb"><div class="h5"><br><br>
<div class="gmail_quote">On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau <span dir="ltr"><<a href="mailto:joshua.landau.ws@gmail.com" target="_blank">joshua.landau.ws@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>
<div>On 23 October 2012 21:06, Joshua Landau <span dir="ltr"><<a href="mailto:joshua.landau.ws@gmail.com" target="_blank">joshua.landau.ws@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote">
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>
<div>On 23 October 2012 21:03, Joshua Landau <span dir="ltr"><<a href="mailto:joshua.landau.ws@gmail.com" target="_blank">joshua.landau.ws@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote">
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>On 23 October 2012 12:07, Jean-Michel Pichavant <span dir="ltr"><<a href="mailto:jeanmichel@sequans.com" target="_blank">jeanmichel@sequans.com</a>></span> wrote:<br></div>
<div class="gmail_quote">
<div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div>----- Original Message -----<br><br>> Thankyou.. but my problem is different than simply joining 2 lists<br>> and it is done now :)....<br><br><br></div>A lot of people though you were asking for joining lists, you description was misleading.<br>

<br>I'll take a guess: you want to flatten a list of list.<br>"Nested" list comprehensions can do the trick.<br><br>aList =[[1,5], [2,'a']]<br>[item for sublist in aList for item in sublist]<br><br>
...<br>
[1, 5, 2, 'a']<br><br>I find it rather difficult to read though.</blockquote>
<div><br></div></div>
<div>We have a library function for this, in the one-and-only itertools.</div>
<div>
<div><br></div>
<blockquote style="BORDER-LEFT:rgb(204,204,204) 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">>>> listoflists = [list(range(x, 2*x)) for x in range(5)]<br>>>> listoflists<br>[[], [1], [2, 3], [3, 4, 5], [4, 5, 6, 7]]<br>

>>> from itertools import chain<br> >>> list(chain.from_iterable(listoflists))<br>[1, 2, 3, 3, 4, 5, 4, 5, 6, 7]</blockquote></div>
<div><br></div></div>It does exactly what it says... fast and easy-to-read. </blockquote></div><br></div></div>
<div>Note that I think what he really wanted is to go from</div>
<div><br></div>
<blockquote style="BORDER-LEFT:rgb(204,204,204) 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">a, b, c = [list(x) for x in (range(10), range(11, 20), range(21, 30))]</blockquote>
<div>to</div>
<blockquote style="BORDER-LEFT:rgb(204,204,204) 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">list(range(30))</blockquote></blockquote></div><br></div></div>
<div>UNDO! UNDO! UNDO!</div>
<div><br></div>
<div>I <i>meant </i>to say:</div>
<div><br></div>
<div>
<div>
<div>Note that I think what he really wanted is to go from</div>
<div><br></div>
<blockquote style="BORDER-LEFT:rgb(204,204,204) 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">a, b, c = [list(x) for x in (range(10), range(11, 20), range(21, 30))]</blockquote>
<div>to</div></div>
<blockquote style="BORDER-LEFT:rgb(204,204,204) 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">[a, b, c]</blockquote></div></blockquote></div><br>
</div></div></blockquote></div><br>