<h2>wanted<span class="aaa">www</span></h2>
h2 = soup.find('h2')
span = soup.find('span')
span.decompose()
print(h2.text) // wanted
h2 = soup.find('h2').text
span = soup.find('span')
span.decompose()
print(h2) // wanted www
<h2>wanted<span class="aaa">www</span></h2>
h2 = soup.find('h2')
span = soup.find('span')
span.decompose()
print(h2.text) // wanted
h2 = soup.find('h2').text
span = soup.find('span')
span.decompose()
print(h2) // wanted www