Strip the first (top level) tag in Beautifulsoup
Strip the first (top level) tag in Beautifulsoup Question: I create a soup: from bs4 import BeautifulSoup soup = BeautifulSoup("<div><p>My paragraph <a>My link</a></p></div>", "html.parser") I want to strip the first top-level tag to reveal its contents, regardless of the tag: <p>My paragraph<a>My link</a></p> with all the children. So I don’t want to find and replace …