54-5: parsing html using BeautifulSoup library and find_all method



In the instruction, it has been asked for the text of the second paragraph. The answer just used the find_all method to get the content of p tag with id=“second”. But, in the p tag, there is also a b tag which I think we need to extract the content of this tag also using the find_all method again or using the attribute method. I think I faced this issue because I do not know exactly what the find_all method does when we give a tag name as an argument to it. I appreciate it if you could help me with this problem.

Screen Link: https://app.dataquest.io/m/54/web-scraping/5/element-ids

My Code:

p_second = parser.find_all("p", id="second")[0]
second_paragraph = parser.find_all("b")[0]
second_paragraph_text = second_paragraph.text