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 +=

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

2005-12-20 Thread ps python
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 your replies. Here fromstring() assuming that the input is in a kind of text format. Right

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 for m

[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

[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

[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: biological_processess biological_process Signal transduction /biological_process biological_process

[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: biological_processess biological_process Signal transduction /biological_process biological_process Energy process /biological_process /biological_processess

[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

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