# -*- coding: utf-8 -*- """ htmlEscape(string text) -> string [en] works like php htmlspecialchars(). See also http://wiki.python.org/moin/EscapingHtml [pl] działa jak htmlspecialchars w php. Zobacz też (link powyzej)/ """ def htmlEscape(text): """Produce entities within text.""" html_escape_table = { "&": "&", '"': """, "'": "'", ">": ">", "<": "<", } L=[] for c in text: L.append(html_escape_table.get(c,c)) return "".join(L)