Raw string substitution problem

Ed Keith e_d_k at yahoo.com
Wed Dec 16 09:09:32 EST 2009


I am having a problem when substituting a raw string. When I do the following:

re.sub('abc', r'a\nb\nc', '123abcdefg')

I get

"""
123a
b
cdefg
"""

what I want is 

r'123a\nb\ncdefg'

How do I get what I want?

Thanks,

    -EdK

Ed Keith
e_d_k at yahoo.com

Blog: edkeith.blogspot.com


      



More information about the Python-list mailing list