python - How to limit the result of select tag in beautifulsoup? -


for example, have this:

result = soup.select('div#test > div.filters > span.text') 

i want limit result of above list 10 items.

in case of find_all() 1 can use limit argument select()?

there no limit argument select(), can slice resultset:

soup.select('div#test > div.filters > span.text')[:10] 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

html - href attribute breaking an element -

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -