Re: [Tutor] getting text within an element [attribute text] using elementtree

2006-01-19 Thread ps python
Dear group, In my XML file some attributes have text within an element. I want to get that text. How can I do that. I looked into ElementTree -bits and pieces: and there is a small function. >>> def gettext(elem): ... text = elem.text or "" ... for e in elem: ... text += get

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
Dear drs. Yoo and johnson, Thank you very much for your help. I successully parsed my GO annotation from all 16,000 files. thanks again for your kind help --- Danny Yoo <[EMAIL PROTECTED]> wrote: > > > >>> for m in mydata.findall('//functions'): > > print m.get('molecular_class').text >

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
olute path on element") SyntaxError: cannot use absolute path on element >>> for m in tree.findall('functions'): print m.find('molecular_class').text >>> for m in tree.findall('functions'): print m.find('molecular_c

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
it us unparsable. Would you please help me /guide me what the problem is. Apologies if i am completely ignoring somethings. PS: Attached is the XML file that I am using. --- Kent Johnson <[EMAIL PROTECTED]> wrote: > ps python wrote: > > Kent and Dany, > > Thanks for y

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
-Repost. considering that my previous email lost - hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good fruit'

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good fruit' - getting this back into a string has drained my brain.

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
x27;) iter = root.getiterator() Here the whole XML document is loaded as element tree and how should this iter into a format where I can apply findall() method. thanks mdan --- Kent Johnson <[EMAIL PROTECTED]> wrote: > ps python wrote: > > Hi, > > > > using Ele

[Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
Hi, using ElementTree, how can I extract text of a particular element, or a child node. For example: Signal transduction Energy process I looked at some tutorials (eg. Ogbuji). Those examples described to extract all text of nodes and child nodes. In

[Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
Hi, using ElementTree, how can I extract text of a particular element, or a child node. For example: Signal transduction __ Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.sha

Re: [Tutor] regular expressions

2005-12-07 Thread ps python
sorry for repost. awaiting to hear from some members. a scientist suggested me to try biopython. This point is not just with genbank sequences. what will i do if i have to parse a paragraph for some expression. thanks again. hi, I am a new python learner. i am trying to parse a file using

[Tutor] regular expressions

2005-12-07 Thread ps python
hi, I am a new python learner. i am trying to parse a file using regular expressions. LOCUS NM_005417 4145 bpmRNA linear PRI 04-DEC-2005 DEFINITION Homo sapiens v-src sarcoma (Schmidt-Ruppin A-2) viral oncogene homolog (avian) (SRC), transcript variant