如何获得不确定的“< p>”使用零食的标签?
如何使用scrapy获取不确定的< p>
标签的文字?如以下两个示例所示:
获取所有< p>
在< h2> h2> xxxx特征</h2>
或or
< h3< h3< /h3>
< div class =“ entry-content”>
的内部,然后将< p>
的块合并到其他字段中,但< p>
的数量尚不确定。
How to get text of uncertain number of <p>
tag using scrapy? as in the following two examples:
Get all <p>
text after <h2>XXXX Characteristics</h2>
or <h3>XXXX Diet</h3>
inside of <div class="entry-content">
, then merge block of <p>
to other field, but the number of <P>
is uncertain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试提取
div
的所有孩子,并执行正则测试,以查看是否是h2
或h3
,然后测试是否文本CONATINS“ Diet”
或“特征”
,如果它通过,则收集所有兄弟姐妹,其中&lt; p&gt;
。You can try extracting all the children of the
div
and perform a regex test to see if it is anh2
orh3
then test if the text conatins"Diet"
or"Characteristics"
and if it passes collect all siblings with that are<p>
.