When you use \'
within the string, it takes '
as the part of string (and not the closing string quote). \
is know as escape character. You need to write it as:
add = '\\'
As per String Literals: Escape Characters document, below is the list of all the Escape Sequences with their meanings:
Escape Sequence Meaning
\newline Ignored
\\ Backslash (\)
\' Single quote (') # <---- Cause of error in your code
\" Double quote (")
\a ASCII Bell (BEL)
\b ASCII Backspace (BS)
\f ASCII Formfeed (FF)
\n ASCII Linefeed (LF)
\r ASCII Carriage Return (CR)
\t ASCII Horizontal Tab (TAB)
\v ASCII Vertical Tab (VT)
\uxxxx Character with 16-bit hex value XXXX (Unicode only (1)
\Uxxxxxxxx Character with 32-bit hex value XXXXXXXX (Unicode only) (2)
\v ASCII Vertical Tab (VT)
\ooo Character with octal value OOO (3,5)
\xhh Character with hex value HH (4,5)