Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Python Xmlspecialchars Function

DZone's Guide to

Python Xmlspecialchars Function

· ·
Free Resource
Escape the five XML special chars.


def xmlspecialchars(text):
        return text.replace(u"&", u"&")\
               .replace(u"<", u"<")\
               .replace(u">", u">")\
               .replace(u"'", u"'")\
               .replace(u'"', u""")
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}