title: Removing elements from a list containing specific characters
body: <p>I want to remove all elements in a list which contains (or does not contain) a set of specific characters, however I'm running in to problems iterating over the list and removing elements as I go along. Two pretty much equal examples of this is given below. As you can see, if two elements which should be removed are directly following each other, the second one does not get removed.</p>
  
  <p>Im sure there are a very easy way to do this in python, so if anyone know it, please help me out - I am currently making a copy of the entire list and iterating over one, and removing elements in the other...Not a good solution I assume</p>
  
  <pre><code>&gt;&gt;&gt; l
  ['1', '32', '523', '336']
  &gt;&gt;&gt; for t in l:
  ...     for c in t:
  ...         if c == '2':
  ...             l.remove(t)
  ...             break
  ...             
  &gt;&gt;&gt; l
  ['1', '523', '336']
  &gt;&gt;&gt; l = ['1','32','523','336','13525']
  &gt;&gt;&gt; for w in l:
  ...     if '2' in w: l.remove(w)
  ...     
  &gt;&gt;&gt; l
  ['1', '523', '336']
  </code></pre>
  
  <p>Figured it out:</p>
  
  <pre><code>&gt;&gt;&gt; l = ['1','32','523','336','13525']
  &gt;&gt;&gt; [x for x in l if not '2' in x]
  ['1', '336']
  </code></pre>
  
  <p>Would still like to know if there is any way to set the iteration back one set when using for x in l though. </p>