jeudi 27 mars 2014

Python and Beautifulsoap: strange behaviour with findAll


Vote count:

0





soup = BeautifulSoup(html)
boxes = soup.findAll("div", { "class" : re.compile(r'\bmixDesc\b') })


I think I got only boxes of class 'mixDesc'.


So I'm debugging to be sure



for box in boxes :
print "box"
print box


I've only 10 divs with mixDesc class in the parsed html file


But I got 30 boxes and a lot (20 out of 30) are printed as



[]


Can you explain why this happens? Why findAll grab this empty tags ? Or ... What else mistake have I take ?



asked 26 secs ago






Aucun commentaire:

Enregistrer un commentaire