I want to extract information from a couple of xml file as here:
https://github.com/peldszus/arg-microtexts/blob/master/corpus/en/micro_b001.xml
I want to only extract this tag information:
<arggraph id="micro_b001" topic_id="waste_separation" stance="pro">
which is : "micro_b001" "waste_separation"
I want to save them as list
I have tried this:
myList = []
myEdgesList=[]
#read the whole text from
for root, dirs, files in os.walk(path):
for file in files:
if file.endswith('.xml'):
with open(os.path.join(root, file), encoding="UTF-8") as content:
tree = ET.parse(content)
myList.append(tree)
this above code is correct it give information of each file as
<xml.etree.ElementTree.ElementTree at 0x21c893e34c0>,
but this looks not correct
for k in myList:
arg= [e.attrib['stance'] for e in k.findall('.//arggraph') ]
print(arg)
the second code doesn't give the required value to me