html - python BeautifulSoup find all input for specific form -
i'm trying use beautifulsoup
extract input fields specific form only.
extracting form using following:
soup.find('form')
now want extract input fields child form only.
how can bs?
as noted in comments, chain find
, find_all()
context-specific search:
form = soup.find('form') inputs = form.find_all('input')
if want direct input
elements only, add recursive=false
:
form.find_all('input', recursive=false)
or, using css selectors:
soup.select("form input")
and, getting direct input
child elements only:
soup.select("form > input")
Comments
Post a Comment