error-tolerant HTML parser for Python The BeautifulSoup class turns arbitrarily bad HTML into a tree-like nested tag-soup list of Tag objects and text snippets. A Tag object corresponds to an HTML tag. It knows about the HTML tag's attributes, and contains a representation of everything contained between the original tag and its closing tag (if any). It's easy to extract Tags that meet certain criteria.