title: How to isolate values from a list in Python?
body: <p>I have a few lists I'm trying to investigate.I'm stuck at some point:</p>
  
  <pre><code>D = [1, 1, 1, 2, 5, 1, 1, 1, 1, 1, 3, 2, 1, 1]
  </code></pre>
  
  <p>Let's say this is the list. I need to isolate a new list from the list D.We can say I want to filter those "1"'s; but I couldn't manage it.</p>
  
  <p>If I use "index" method like:</p>
  
  <pre><code>D = [1, 1, 1, 2, 5, 1, 1, 1, 1, 1, 3, 2, 1, 1]
  
  E = []
  
  for i in D:
      if not i == 1:
          E.append(D.index(i))
  
  print(E)
  </code></pre>
  
  <p>The output is: [3, 4, 10, 3].What I need is [3, 4, 10, 11].Since values are at D[3] and D[11] are the same, python does not allow me to get the second one.How can I solve this? </p>
  
  <p>Your help is highly appreciated.</p>
  
  <p>Thanks.</p>