re.sub

Chris Mellon arkanes at gmail.com
Tue Oct 16 14:12:00 EDT 2007


On 10/16/07, Massimo Di Pierro <mdipierro at cti.depaul.edu> 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.



More information about the Python-list mailing list