On Dec 4, 2007 11:33 AM, Nick <[EMAIL PROTECTED]> wrote: > Try "123 *?/ abc d;o /$'" as the argument... and you get - > > 123 \*\?\/ abc d\\;o \/\$
That's because of the order you're doing the replacement. Put a print statement inside your for loop and you'll see something like this: input starts as "123 *?/ abc d;o /$'" Then when you replace ';' with '\;' you get input = "123 *?/ abc d\;o /$'" Then the next replacement replaces '\' with '\\' so you get input = "123 *?/ abc d\\;o /$'" If you move '\\' to the front of your list of replacement characters, things will probably work as you expect. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list