That is not the problem. The problem is that re.sub('a','\\n','bab')
cannot be the same as re.sub('a','\n','bab') This is evaluating the string to be substituted before the substitution. Massimo ________________________________________ From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Chris Mellon [EMAIL PROTECTED] Sent: Tuesday, October 16, 2007 1:12 PM To: python-list@python.org Subject: Re: re.sub On 10/16/07, Massimo Di Pierro <[EMAIL PROTECTED]> wrote: > Even stranger > > >>> re.sub('a', '\\n','bab') > 'b\nb' > >>> print re.sub('a', '\\n','bab') > b > b > You called print, so instead of getting an escaped string literal, the string is being printed to your terminal, which is printing the newline. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list