Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def generate_xml(self, toxml):
g = io.StringIO()
for i in toxml:
if (toxml[i] != '') & (self.root.find(i) is not None):
self.root.find(i).text = toxml[i]
elif (toxml[i] != '') & (self.root.find(i) is None):
newelem = etree.Element(i)
newelem.text = toxml[i]
self.root.find('ComicInfo').append(newelem) ←このへんはまだ試行錯誤中。動かない。
elif toxml[i] == '':
self.infotree.write(g, encoding='unicode')
return g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment