Quick reference

You can take a look at the following references to get an overview of the code present in this chapter:

  • soup = BeautifulSoup(html_markup,"lxml",from_encoding="latin-1"). Here, from_encoding is used while creating BeautifulSoup to specify the document encoding.
  • soup.original_encoding: This gives the original encoding detected by Beautiful Soup.
  • The output content in specific encoding is listed using the following methods:
    • soup.prettify()
    • soup.encode()

Get Getting Started with Beautiful Soup now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.