Willem Ligtenberg wrote:
As I'm trying to write the code using cElementTree. I stumble across one problem. Sometimes there are multiple values to retrieve from one record for the same element. Like this: <Prot-ref_name_E>ATP-binding cassette, subfamily G, member 1</Prot-ref_name_E> <Prot-ref_name_E>ATP-binding cassette 8</Prot-ref_name_E>
How do you get not only the first, but the rest as well, so that I can store it in a list.
findall returns a list of matching elements. if "elem" is the paretnt element, this gives you a list of the text inside all Prot-ref_name_E child elements:
[e.text for e in elem.findall("Prot-ref_name_E")]
(you have read the elementtree documentation, I hope?)
</F>
-- http://mail.python.org/mailman/listinfo/python-list