xxxxxxxxxx
from bs4 import BeautifulSoup
# Sample HTML code
html = '''
<html>
<body>
<div id="section1">
<h1>Title</h1>
<p>Content of section 1</p>
</div>
<div id="section2">
<h1>Other Title</h1>
<p>Content of section 2</p>
</div>
</body>
</html>
'''
# Parse the HTML code
soup = BeautifulSoup(html, 'html.parser')
# Find the desired section by its ID
section1 = soup.find(id="section1")
# Print the section's HTML
print(section1)