Quoter submodule

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

dhtmlparser.quoter.unescape(inp, quote='"')[source]

Unescape quote in string inp.

Example usage:

>> unescape('hello \"')
'hello "'
Parameters:
  • inp (str) – String in which quote will be unescaped.
  • quote (char, default ") – Specify which character will be unescaped.
Returns:

Unescaped string.

Return type:

str

dhtmlparser.quoter.escape(inp, quote='"')[source]

Escape quote in string inp.

Example usage:

>>> escape('hello "')
'hello \"'
>>> escape('hello \"')
'hello \\"'
Parameters:
  • inp (str) – String in which quote will be escaped.
  • quote (char, default ") – Specify which character will be escaped.
Returns:

Escaped string.

Return type:

str