title: How to delete random items in a list to keep the list in a certain length?
body: <p>I used <strong>pymongo</strong> to dump a list of collections in MongoDB. The length of the list is greater than 10000, about 12000 or longer(The length of the list is not a certain number).</p>
  
  <p>However, I need only 10000 instances of the list. I know that a list <strong>'l'</strong> is able to slice by <code>l[:10000]</code> or <code>l[len(l)-10000:]</code>. But I think maybe a random way to delete the item in a list is better.</p>
  
  <p>So I want to know how can I delete random items in the list to make its length reduce to 10000 long? Thanks.</p>