Albert-Jan Roskam wrote:
>> import lxml.etree
>>
>> tree = lxml.etree.parse("example.xml")
>> print tree.xpath("//objectdata/general/timestamp/text()")
>
> Nice. I do need to try lxml some time. Is the "text()" part xpath as well?
Yes. I think ElementTree supports a subset of XPath.
__
richard kappler wrote:
>> Do you want to find just the second occurence in the *file* or the second
> occurence within a given tag in the file (and there could be multiple such
> tags)?
>
> There are multiple objectdata lines in the file and I wish to find the
> second occurence of timestamp in e
> Do you want to find just the second occurence in the *file* or the second
occurence within a given tag in the file (and there could be multiple such
tags)?
There are multiple objectdata lines in the file and I wish to find the
second occurence of timestamp in each of those lines.
> Is objectdat
On 08/09/15 17:00, richard kappler wrote:
I need to find the index of the second occurance of a string in an xml file
for parsing.
Do you want to find just the second occurence in the *file*
or the second occurence within a given tag in the file (and
there could be multiple such tags)?
I un
I need to find the index of the second occurance of a string in an xml file
for parsing. I understand re well enough to do what I want to do on the
first instance, but despite many Google searches have yet to find something
to get the index of the second instance, because split won't really work on