0
点赞
收藏
分享

微信扫一扫

【四二学堂】搜索文档树find_all方法-limit参数


搜索文档树find_all方法-limit参数

limit参数
文档内容如下:
html_doc = “”"


The Dormouse's story

The Dormouse's story

Once upon a time there were three little sisters; and their names were Elsie, Lacie and Tillie; and they lived at the bottom of a well.

...

"""

find_all()方法返回全部的搜索结构,如果文档树很大那么搜索会很慢。如果我们不需要全部结果,可以使用limit参数限制返回结果的数量。效果与SQL中的limit关键字类似,当搜索到的结果数量达到 limit 的限制时,就停止搜索返回结果。
文档树中有3个tag符合搜索条件,但结果只返回了2个,因为我们限制了返回数量:

【四二学堂】搜索文档树find_all方法-limit参数_html


【四二学堂】搜索文档树find_all方法-limit参数_html_02


举报

相关推荐

0 条评论