🔵 🔵 🔵


Primary

၊၊||၊|။

Tag.decompose() ⚬|Documentation|1st|20260122171125-00-⌔

Beautiful Soup Documentation — Beautiful Soup 4.4.0 documentation#decompose

decompose()

Tag.decompose() removes a tag from the tree, then completely destroys it and its contents:

markup = '<a href="http://example.com/">I linked to <i>example.com</i></a>'
soup = BeautifulSoup(markup)
a_tag = soup.a
 
soup.i.decompose()
 
a_tag
# <a href="http://example.com/">I linked to</a>

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •