Re: problem with newlines in regexp substitution

2006-02-23 Thread James Stroud
Florian Schulze wrote: > See the following results: > > Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > import re s = "1" re.sub('1','\\n',s) > > '\n' > '\\n' > > '\

problem with newlines in regexp substitution

2006-02-23 Thread Florian Schulze
See the following results: Python 2.3.5 (#62, Feb 8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> s = "1" >>> re.sub('1','\\n',s) '\n' >>> '\\n' '\\n' >>> re.sub('1',r'\\n',s) '\\n' >>> s.replace('1',