raw strings
Michele Simionato
mis6 at pitt.edu
Tue Oct 8 17:28:30 EDT 2002
Is there a function which converts a string in a raw string ?
I mean: if for instance
>>> s='\*hello\*\n'
I want a function raw_string such that
>>> rs=raw_string(s)
is equal to r'\*hello\*\n'.
I tried with
raw_string=lambda s: repr(s)[1:-1]
but doesn't work since the '\*' are escaped to '\\*' whereas r'\*'='\*'.
There must be an internal function doing what I want, but I don't find it.
Michele
More information about the Python-list
mailing list