Skip to content

Instantly share code, notes, and snippets.

@z-------------
Last active August 29, 2015 14:18
Show Gist options
  • Save z-------------/27289d75a7273efe1a30 to your computer and use it in GitHub Desktop.
Save z-------------/27289d75a7273efe1a30 to your computer and use it in GitHub Desktop.
import xml.etree.ElementTree as ET
def xml_modify(fname, attr, val):
tree = ET.parse(fname)
root = tree.getroot()
for child in root:
child.attrib[attr] = val
return(ET.tostring(root).decode("utf-8"))
'''
xml_modify("Cloud.svg", "fill", "#ffffff")
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment