This commit is contained in:
Mark Pilgrim
2009-07-27 05:52:52 -04:00
parent 18100ced38
commit bfcc837835
+1 -1
View File
@@ -382,7 +382,7 @@ ValueError: list.index(x): x not in list</samp></pre>
ValueError: list.remove(x): x not in list</samp></pre>
<ol>
<li>You can also remove an item from a list with the <code>remove()</code> method. The <code>remove()</code> method takes a <em>value</em> and removes the first occurrence of that value from the list. Again, all items after the deleted item will have their positional indices bumped down to &#8220;fill the gap.&#8221; Lists never have gaps.
<li>You can call the <code>remove()</code> method has often as you like, but it will raise an exception if you try to remove a value that isn&#8217;t in the list.
<li>You can call the <code>remove()</code> method as often as you like, but it will raise an exception if you try to remove a value that isn&#8217;t in the list.
</ol>
<h3 id=popgoestheweasel>Removing Items From A List: Bonus Round</h3>