title: selecting second child in beautiful soup with soup.select?
body: <p>I have:</p>
  
  <pre><code>&lt;h2 id='names'&gt;Names&lt;/h2&gt;
  &lt;p&gt;John&lt;/p&gt;
  &lt;p&gt;Peter&lt;/p&gt;
  </code></pre>
  
  <p>now what's the easiest way to get the Peter here if I have h2 tag already? Now I've tried:</p>
  
  <pre><code>soup.select("#names &gt; p:nth-child(1)")
  </code></pre>
  
  <p>but here I get nth-child NotImplementedError:</p>
  
  <pre><code>NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.
  </code></pre>
  
  <p>So I'm not sure what's going on here. The second option was to just get all 'p' tag  children and hard select [1] but then there's a danger of index out of range which would require to surround every attempt to get <em>Peter</em> with try/except which is a bit silly.</p>
  
  <p>Any way to select nth-child with soup.select() function?</p>
  
  <p><strong>EDIT:</strong>
  replacing nth-child with nth-of-type seemed to do the trick, so the correct line is:</p>
  
  <pre><code>soup.select("#names &gt; p:nth-of-type(1)")
  </code></pre>
  
  <p>not sure why it doesn't accept nth-child but it seems that both nth-child and nth-of-type return the same results.</p>