(python) BeautifuSoup library find() and findAll() (Crawling)
The most usage of methods are find() and findAll() in BeautifulSoup.
If you use these methods, you can filter tags according to various attributes in HTML page.
The next two methods show what parameters
findAll(tag, attributes, recursive, text, limit, keywords)
find(tag, attributes, recursive, text, keywords)
the paramteres are mostly same in two methods.
First, tag parameter can be string type or list type;
Second, attributes parameters can be dictionary type and find a equivalent tag of them
Third, recursive type is boolean. if it is True value, findAll() search for children and children of children. If it is Fals value. it will find only first tag.(Default is True)
Fourth, It is different that text parameter is not a tag attribute but text contents.
for example, it can show how many "the clothes",
(.findAll(text = "the clothes")
and the next is
it returns both James tag and Marry tag.
.findAll("span", {"class":{"green", "red"}})
If you use these methods, you can filter tags according to various attributes in HTML page.
The next two methods show what parameters
findAll(tag, attributes, recursive, text, limit, keywords)
find(tag, attributes, recursive, text, keywords)
the paramteres are mostly same in two methods.
First, tag parameter can be string type or list type;
Second, attributes parameters can be dictionary type and find a equivalent tag of them
Third, recursive type is boolean. if it is True value, findAll() search for children and children of children. If it is Fals value. it will find only first tag.(Default is True)
Fourth, It is different that text parameter is not a tag attribute but text contents.
for example, it can show how many "the clothes",
(.findAll(text = "the clothes")
and the next is
it returns both James tag and Marry tag.
.findAll("span", {"class":{"green", "red"}})
댓글
댓글 쓰기