æºä»£ç
from bs4 import BeautifulSoup
html_doc = '''
<div class="line-title">
<span class="title">
<b>
111
<span class="t-small c-green">
ï¼222ï¼
</span>
</b>
</span>
<span class="sechovershow jzbtn c-lined small marl10 act-ugc-edit act-ugc-edit-base1" style="margin-top:-5px">
<i class="fa fa-pencil"></i>
ç¼è¾
</span>
</div>
'''
soup = BeautifulSoup(html_doc, "html.parser")
# å级ç
didi = soup.b.next_element.strip()
invest = soup.b.span.next_element.strip()
# è¿é¶ç
didi, invest = soup.b.stripped_strings
温馨提示:内容为网友见解,仅供参考