例如先找到<p> class='info'的元素,继续在<p>内部获取<span>元素内的文字:
p1=soup.find_all('p',class_='info')
for each in p1:
txtlist=each.find_all('span')
for eachs in txtlist:
txtstr=eachs.string
或者:提取第一个p标签中第一个span元素内的文字
p2=soup.select('p.info')
txt=p2[0].select('span')[0].get_text()
#########
p3=soup.find_all('p',class_='info')
txt=p3[0].find('span').string