am i using findNextSibling wrong?

localpricemaps at gmail.com localpricemaps at gmail.com
Tue Jan 24 19:01:12 CET 2006


i have this html:

<td class="price">

    <a class="nojs" name="D1L4" href="/xPopups/nojs"
target="_blank">3.99</a>


                <div class="food">1.05</div>


                <div class="drink">3</div>

        <a class="btn" name="D1" href="http://www.cnn.com"
target="_blank" onclick="reload()">

i tried to this use this python to scrape out the href cnn.com and
failed.

for incident in row('td', {'class':'price'}):
  n = incident.findNextSibling('a')
  b = n.findNextSibling('div')
  c = b.findNextSibling('div')
  d = c.findNextSibling('a', {'class': 'btn'}')
  info = d['href'] + "','"
  print info

and i tried this
	for incident in row('td', {'class':'price'}):
       		n = incident.findNextSibling('a', {'class': 'btn'})
       		info = n['href'] + "','"
		print info




More information about the Python-list mailing list