SoupStrainer includes DOCTYPE?!?

19 views
Skip to first unread message

Marco Heins

unread,
Mar 21, 2016, 9:48:54 AM3/21/16
to beautifulsoup
Hi all,

I used SoupStrainer to limit the search to p-tags in an arbitrary html file. I was surprised to see it included the DOCTYPE as the first element. This behavior seems confusing to me cause I thought to deal with only p-tags in soup.contents, e. g. the DOCTYPE object has no text attribute leading to an error when trying to iterate over it. Not sure wether this is intentional or considered to be a bug?

regards Marco

Elizabeth Frazier

unread,
Mar 28, 2016, 7:36:12 AM3/28/16
to beautifulsoup
Can you paste the code you are using to define the SoupStrainer as well as the code you are using for the BeautifulSoup constructor where you first make the soup? Also what are the results of the diagnose() function?
Reply all
Reply to author
Forward
0 new messages