Skip to content

Instantly share code, notes, and snippets.

@walkerdb
Created October 5, 2015 14:50
Show Gist options
  • Select an option

  • Save walkerdb/0620bfa65cb180febf8e to your computer and use it in GitHub Desktop.

Select an option

Save walkerdb/0620bfa65cb180febf8e to your computer and use it in GitHub Desktop.
# turn the root etree into a string
ead_text = etree.tostring(tree, xml_declaration=True, encoding="utf-8")
# write the string to your new EAD file
# the directory path and filename can be whatever you'd like
with open(os.path.join("path/to/ead/directory", "new_ead.xml"), mode="w") as f:
f.write(ead_text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment