bs4.BeautifulSoup.decode_contents

BeautifulSoup.decode_contents(indent_level=None, eventual_encoding='utf-8', formatter='minimal')

Renders the contents of this tag as a Unicode string.

Parameters:
  • indent_level – Each line of the rendering will be indented this many spaces.
  • eventual_encoding – The tag is destined to be encoded into this encoding. This method is _not_ responsible for performing that encoding. This information is passed in so that it can be substituted in if the document contains a <META> tag that mentions the document’s encoding.
  • formatter – The output formatter responsible for converting entities to Unicode characters.