I'm messing around with trying to write an xml file using
xml.etree.Eleme ntTree. All the examples on the internet show the use
of ElementTree.wri te(), although when I try to use it it's not
available, gives me ...
ElementTree(sec tionElement).wr ite("section.xm l")
TypeError: 'module' object is not callable
I'm new to python, so I think I'm doing something wrong.. any
thoughts?
Thanks.'
See code below:
# Create xml structure
sectionElement = ElementTree.Ele ment("section")
# step through feed result and create elements for each article -
result[article]
for article in feedResult:
articleElement = ElementTree.Ele ment("article")
titleElement = ElementTree.Sub Element(article Element, "title")
titleElement.te xt = article['title']
bodyElement = ElementTree.Sub Element(article Element, "body")
bodyElement.tex t = article['body']
sectionElement. append(articleE lement)
#print ElementTree.tos tring(sectionEl ement)
ElementTree(sec tionElement).wr ite("section.xm l")
xml.etree.Eleme ntTree. All the examples on the internet show the use
of ElementTree.wri te(), although when I try to use it it's not
available, gives me ...
ElementTree(sec tionElement).wr ite("section.xm l")
TypeError: 'module' object is not callable
I'm new to python, so I think I'm doing something wrong.. any
thoughts?
Thanks.'
See code below:
# Create xml structure
sectionElement = ElementTree.Ele ment("section")
# step through feed result and create elements for each article -
result[article]
for article in feedResult:
articleElement = ElementTree.Ele ment("article")
titleElement = ElementTree.Sub Element(article Element, "title")
titleElement.te xt = article['title']
bodyElement = ElementTree.Sub Element(article Element, "body")
bodyElement.tex t = article['body']
sectionElement. append(articleE lement)
#print ElementTree.tos tring(sectionEl ement)
ElementTree(sec tionElement).wr ite("section.xm l")
Comment