title: Removing elements from a list in python based on digits
body: <p>I have a list of integers and I want to remove all integers that have 7, 8, 9 or 0 in them.</p>
  
  <p>This is what I have done so far:</p>
  
  <pre><code>import numpy as np
  def P(n):
      list = []
      for i in range(10**(n-1),7*10**(n-1)):
          list.append(i)
      for i in list:
          for k in str(i):
              if k in ['7','8','9','0']: list.remove(i)
              #elif k == '8': list.remove(i)
              #elif k == '9': list.remove(i)
              #elif k == '10': list.remove(i)
      return list
  </code></pre>
  
  <p>But it returns this:</p>
  
  <pre><code>[11, 12, 13, 14, 15, 16, 18, 20, 21, 22, 23, 24, 25, 26, 28, 30, 31, 32, 33, 34, 35, 36, 38, 40, 41, 42, 43, 44, 45, 46, 48, 50, 51, 52, 53, 54, 55, 56, 58, 60, 61, 62, 63, 64, 65, 66, 68]
  </code></pre>
  
  <p>How can i fix this code so that it gets rid of the unwanted values? i.e. 18, 20, 28, 30 etc.</p>