The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 18, 2019, 11:25:08 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Make BeatifulSoup work with python 2.6 and up  (Read 2054 times)
arms
Expert
****
Offline Offline

Posts: 235



View Profile
« on: May 26, 2009, 06:24:52 AM »

BeautifulSoup doesn't work so good with python 2.6 and up
http://www.crummy.com/software/BeautifulSoup/3.1-problems.html

instead of this:
Code:
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(some_html)

do this:
Code:
import html5lib
parser = html5lib.HTMLParser(tree=html5lib.treebuilders.getTreeBuilder("beautifulsoup"))
soup = parser.parse(some_html)

you would need to have both BeautifulSoup and html5lib installed of course.
Logged
PureThree
n00b
*
Offline Offline

Posts: 1


View Profile
« Reply #1 on: June 01, 2009, 12:39:22 AM »

Kerpow!
« Last Edit: June 01, 2009, 02:36:11 PM by perkiset » Logged

No links in signatures please
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!