ps python wrote:
> Dear Drs. Johnson and Yoo , 
>  for the last 1 week I have been working on parsing
> the elements from a bunch of XML files following your
> suggestions. 
> 
> from elementtree.ElementTree import ElementTree
> 
>>>>mydata = ElementTree(file='00004.xml')
>>>>for process in
> 
> mydata.findall('//biological_process'):
>       print process.text

Looking at the data, neither <biological_process> nor <functions> elements 
directly
contain text, they have children that contain text. Try
   print process.get('title').text
to print the title.

>>>>for proc in mydata.findall('functions'):
>       print proc

I think you want findall('//functions') to find <functions> at any depth in the 
tree.

If this doesn't work please show the results you get and tell us what you 
expect.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to