Replacing "\"s using re.sub

Edward C. Jones edcjones at erols.com
Sat Feb 19 11:34:59 EST 2000


I need to replace all instances of "\" in a string with "\\". The
function "re.sub" looks like the way to do it. "re.sub" is called
by "re.sub(pattern, repl, string)". For my problem what should
"pattern" and "repl" be?

Thanks,
  Edward C. Jones





More information about the Python-list mailing list