python/xpath question..
- From: "bruce" <bedouglas@xxxxxxxxxxxxx>
- Date: Wed, 3 Sep 2008 13:36:50 -0700
morning....
i apologize up front as this is really more of an xpath question..
in my python, i'm using the xpath function to iterate/parse some html. i can
do something like
s=d.xpath("//tr/td/text()")
count=len(s)
and get the number of nodes that have text
i can then do something like
s=d.xpath("//tr/td")
count2=len(s)
and get the number of total nodes...
by subtracting, i can get the number of nodes, without text.. is there an
easier way??!!
count2-count
ie, if i have something like
<tr>
<td></td>
<td>foo</td>
</tr>
is there a way to get the count that there is a single "td" node with
text()=""
thanks
.
- Prev by Date: Re: How to write verbose scripts
- Next by Date: Re: converting a sed / grep / awk / . . . bash pipe line into python
- Previous by thread: Re: Usual practice: running/testing modules in a package
- Next by thread: Re: python/xpath question..
- Index(es):