title: index Nd array with list of length N in python
body: <p>This seems like a simple problem but I can't figure it out. </p>
  
  <p>I have a numpy array of an arbitrary dimension (rank) N. I need to set a single element in the array to 0 given by the index values in a 1D array of length N. So for example:</p>
  
  <pre><code>import numpy as np
  A=np.ones((2,2,2))
  b=[1,1,1]
  </code></pre>
  
  <p>so at first I thought</p>
  
  <pre><code>A[b]=0
  </code></pre>
  
  <p>would do the job, but it did not. 
  If I knew A had a rank of 3 it would be a simple case of doing this:</p>
  
  <pre><code>A[b[0],b[1],b[2]]=0
  </code></pre>
  
  <p>but the rank of A is not known until runtime, any thoughts?</p>