I need to parse an html document which contains \"code\" tags
I\'m getting the code blocks like this:
soup = BeautifulSoup(str(content))
code_blocks
Add the code tag to the QUOTE_TAGS dictionary.
from BeautifulSoup import BeautifulSoup
content = "<code class='csharp'>List<Person> persons = new List<Person>();</code>"
BeautifulSoup.QUOTE_TAGS['code'] = None
soup = BeautifulSoup(str(content))
code_blocks = soup.findAll('code')
Output:
[<code class="csharp"> List<Person> persons = new List<Person>(); </code>]