title: How to Index multiple items of array with intervals in Python
body: <p>Suppose that I have a list:</p>
  
  <pre><code>import numpy as np
  a = [2, 4, 6, 8, ..., 1000] # total 500 elements
  b = np.array(a)             # numpy version
  </code></pre>
  
  <p>I want to get <em>1st to 100th, 201st to 300th, 401st to 500th</em> elements and make them into a new array.</p>
  
  <p>To this end, I've tried the following codes:</p>
  
  <pre><code>a_sub = a[0:100] + a[200:300] + a[400:500]
  b_sub = np.concatenate((b[0:100], b[200:300], b[400:500]))
  </code></pre>
  
  <p>But I want to do it with a simple oneline-indexing</p>
  
  <p>Say:</p>
  
  <pre><code>a_sub = a[(0:100, 200:300, 400:500)]
  a_sub = a[[0:100, 200:300, 400:500]]
  b_sub = b[[0:100, 200:300, 400:500]]
  b_sub = b[[0:100, 200:300, 400:500]]
  </code></pre>
  
  <p>But the above are all invalid and I couldn't find such a oneliner indexing.</p>