I'm trying to use BeautifulSoup to extract input fields for a specific form only.
Extracting the form using the following:
soup.find('form')
Now I want to extract all input fields which are a child to that form only.
How can I do that with BS?
I'm trying to use BeautifulSoup to extract input fields for a specific form only.
Extracting the form using the following:
soup.find('form')
Now I want to extract all input fields which are a child to that form only.
How can I do that with BS?
Copyright © 2021 Jogjafile Inc.
As noted in comments, chain
findandfind_all()for the context-specific search:If you want direct
inputelements only, addrecursive=False:Or, using CSS selectors:
And, getting direct
inputchild elements only: