escape_mod module

Provides functions for escaping and unescaping strings.

It’s not very space-efficient - it doubles the length of the string. But it’s pretty easy to read the quoted strings, and the code is simple.

escape_mod.character(number)[source]

Convert a single number from 0 to 255 to bytes.

escape_mod.escape(string)[source]

Escape a string for saving in a text format.

escape_mod.hexadecimal(hex_digit)[source]

Convert a number from 0 to 15 to hexadecimal.

escape_mod.ordinal(char)[source]

Convert a character to its ordinal value.

escape_mod.unescape(quoted_string)[source]

Unescape an escaped string when retrieving from a text format.