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 -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -