title: Is there a simple way to delete a list element by value?
body: <p>I want to remove a value from a list if it exists in the list (which it may not).</p>
  <pre><code>a = [1, 2, 3, 4]
  b = a.index(6)
  
  del a[b]
  print(a)
  </code></pre>
  <p>The above gives the error:</p>
  <pre class="lang-none prettyprint-override"><code>ValueError: list.index(x): x not in list
  </code></pre>
  <p>So I have to do this:</p>
  <pre><code>a = [1, 2, 3, 4]
  
  try:
      b = a.index(6)
      del a[b]
  except:
      pass
  
  print(a)
  </code></pre>
  <p>But is there not a simpler way to do this?</p>