title: Convert list of list into one big list python
body: <p>I have a list like:</p>
  
  <pre><code>list1 = [1  2  1 ... 1  399]
  </code></pre>
  
  <p>And another one:</p>
  
  <pre><code>list2 = [5 4  3  4  2 0]
  </code></pre>
  
  <p>list1 has numbers from <code>0 to 399</code>, with duplicates and its length is <code>5000</code>, <code>list2</code> has  length of <code>400</code>, the index of each <code>list2</code> elements represents the number of the element in <code>list1</code>, that's why it has <code>400</code> length.
  I want to return a list that has a length of <code>5000</code> (same as list1), with checking each element, if the first element of list1 is 1, I want to add the index of 1 in list2 into the new list, which in this case is 4,
  so the new list should be </p>
  
  <pre><code>new_list = [ 4 , ...]
  </code></pre>
  
  <p>and so on for all the items until it comes</p>
  
  <p>I tried this but didn't work:</p>
  
  <pre><code>labels=labels.tolist()
  labels2=labels2.tolist()
  new=list()
  
  for i in range(len(labels1)):
       for item,index in enumerate(labels2):
  
           # print(item)
            if labels1[i] == index :
               # print (str(labels2[i]).index)
                new.append(item)
  
  print(new)
  </code></pre>