[Tutor] Raw string

bob gailer bgailer at gmail.com
Sun Jul 20 18:21:33 CEST 2008

Neven Goršić wrote:
> Hi!
> In every manual and book I read only one way to make a raw string:
> r"e:\mm tests\1. exp files\5.MOC-1012.exp".
> I don't know how to make a string raw string if it is already
> contained in a variable.
> s.raw() or something like that ...

Looking up raw string in the docs yields:
"String literals may optionally be prefixed with a letter "r" or "R"; 
such strings are called /raw strings/ and use different rules for 
interpreting backslash escape sequences."

Note that "raw string" is a form of string literal. The concept does not 
apply to other forms of strings.

 >>> x = r"\t"
 >>> x

I'm guessing you want

 >>> x.raw() # to display

Is that true. That's the only way I can interpret your question.

There is no such function that I'm aware of. One could easily write one.

Bob Gailer
919-636-4239 Chapel Hill, NC

More information about the Tutor mailing list