Skip to content

Instantly share code, notes, and snippets.

@k5trismegistus
Created August 16, 2014 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k5trismegistus/0b884f2c3d77c44cfb2c to your computer and use it in GitHub Desktop.
Save k5trismegistus/0b884f2c3d77c44cfb2c to your computer and use it in GitHub Desktop.
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.root.find(i).remove
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