title: How to get all combinations of length n in python
body: <p>I was wondering if there is any way of getting all combinations of length <code>n</code> from a list of numbers. </p>
  
  <p>For example, if my list is <code>[1, 2, 3, 4]</code>, and I want to output (if I chose n = 3)</p>
  
  <pre><code>[1, 2, 3]
  [1, 2, 4]
  [1, 3, 4]
  [2, 3, 4]
  </code></pre>
  
  <p>the other permutations like [2,1,3] are of no use to me.</p>