Attach the elements of the div .contents tag:
from bs4 import BeautifulSoup data = """ <div id='theDiv'> <p>div content</p> <p>div stuff</p> <p>div thing</p> </div> """ soup = BeautifulSoup(data) div = soup.find('div', id='theDiv') print ''.join(map(str, div.contents))
Print
<p>div content</p> <p>div stuff</p> <p>div thing</p>
source share