I have:
Names
John
Peter
now what\'s the easiest way to get the Pet
'nth-of-child' is simply not implemented in beautifulsoup4 (at time of writing), there is simply no code in the beautifulsoup codebase to do it. The authors explicitly added the 'NotImplementedError' to explain this, here is the code
Given the html you quote in your question you are not looking for a child of h2#names.
What you are really looking for is the second adjacent sibling, I'm not a css selector guru but I found that this worked.
soup.select("#names + p + p")