How do I escape colons in an attribute name with Python's ElementTree?
问题 Background I am using ElementTree in Python version 2.6 to create an XML file (using data retrieved from a database). Code The following line of code is the problem area, as I keep getting a syntax error because of the colons within my attribute names. # Please ignore any errors the "^" characters would cause if they were # actually part of my code - just using them as placeholders. root = ET.Element("databaseConfiguration", xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance", ^ xsi