Getting content from last element using BeautifulSoup find_all
问题 I'm trying to extract the content from the last div in in a list created by find_all. post_content = soup.find_all('div',{'class': 'body_content_inner'}) stores the following text: [<div class="body_content_inner"> post #1 content is here </div>, <div class="body_content_inner"> post #2 content is here </div>] I'd like to extract the text that is stored within the last div tag but I am unsure how to iterate through post_content 回答1: last_div = None for last_div in post_content:pass if last