selecting second child in beautiful soup with soup.select?

后端 未结 3 902
你的背包
你的背包 2020-12-09 04:00

I have:

Names

John

Peter

now what\'s the easiest way to get the Pet

3条回答
  •  没有蜡笔的小新
    2020-12-09 04:32

    Adding your edit as an answer so that it can be more easily found by others:

    Use nth-of-type instead of nth-child:

    soup.select("#names > p:nth-of-type(1)")
    

提交回复
热议问题