I need to parse many xml trees sequentially... I did a 'for' loop and it works perfectly for the first file, bur when starting the second it just takes forever and never prints the answer or follows for the other files.
I have 3 files that are all copies from a same file with diffente names to try the loop, the files are named as follow:
Medline_01.xml
Medline_02.xml
Medline_03.xml
I'm trying the followign loop:
import xml.etree.cElementTree as etree import os path = '/Users/brunap/Desktop/Work/Medline' listing = os.listdir(path) for file in listing: if file.endswith('.xml'): print file data = os.path.join(path, file) tree=etree.parse(data) root = tree.getroot() print root print ""
It gives me the following result
Medline_01.xml
< Element 'PubmedArticleSet' at 0x10878bd80 >
Medline_02.xml
P.S.:And from this I wait for 2h and nothing happens. The first one took 15min
some one can help me with that?
No comments:
Post a Comment