Skip to content Skip to sidebar Skip to footer

Beautiful Soup And Utidy

I want to pass the results of utidy to Beautiful Soup, ala: page = urllib2.urlopen(url) options = dict(output_xhtml=1,add_xml_decl=0,indent=1,tidy_mark=0) cleaned_html = tidy.parse

Solution 1:

Just wrap str() around cleaned_html when passing it to BeautifulSoup.

Solution 2:

Convert the value passed to BeautifulSoup into a string. In your case, do the following edit to the last line:

soup = BeautifulSoup(str(cleaned_html))

Post a Comment for "Beautiful Soup And Utidy"