Source code for dhtmlparser3.quoter

"""
This module provides ability to quote and unquote strings using backslash
notation.
"""

[docs]def escape(inp): """ Escape `quote` in string `inp`. Example usage:: >>> escape('hello "') 'hello "' Args: inp (str): String in which `quote` will be escaped. Returns: str: Escaped string. """ output = "" for c in inp: if c == '"': output += '"' continue output += c return output