Richard Tweeddale
Richard Tweeddale

Reputation: 504

< converted to < when parsing with beautiful soup

I'm using beautiful soup to parse a string containing &lt;br>, which beautiful soup is interpreting as <br>.

Is there a way I can get beautiful soup to stop doing this, so that &lt;br> is left untouched and treated as a plain string, while <br> is parsed normally?

Upvotes: 0

Views: 755

Answers (1)

Arghya Saha
Arghya Saha

Reputation: 5713

You can use formatter="html" to let the interpreter know about it as raw html. Basically the if you play around with the formatter option you can get what you are expecting. The documentation has details about it.

Upvotes: 1

Related Questions