Eric V. Smith added the comment: In addition, you probably want "\\server\path\to" to be a raw string, too. That way, the backslashes are not given special meaning. Notice the difference in output between these two:
>>> "\\server\path\to".strip(r'"\'<>') 'server\\path\to' >>> r"\\server\path\to".strip(r'"\'<>') 'server\\path\\to' In the first one, '\t' is being treated as a tab character, in the second one you see a backslash followed by a 't'. My rule of thumb is: any time you have a string with a filename containing backslashes, you want it to be a raw string. ---------- components: -Regular Expressions nosy: +eric.smith resolution: -> not a bug stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21283> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com