def unescape ( str ) : out = '' prev_backslash = False for char in str : if not prev_backslash and char == '\\' : prev_backslash = True continue out += char prev_backslash = False return out
remove backslash last char from string python
Undoes the effects of the escape () function .
def unescape(str):
    """Undoes the effects of the escape() function."""
    out = ''
    prev_backslash = False
    for char in str:
        if not prev_backslash and char == '\\':
            prev_backslash = True
            continue
        out += char
        prev_backslash = False
    return out