"Phd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> I'm writing a regex related program that lets the user supplies the regex 
> definition. Is there an easy way to convert a string into a raw string?

There ain't no such thing as raw strings.  Just 'raw' string *literals*, 
where 'raw' denotes a mode for converting the literal in the code (which is 
*not* a Python string) into a Python string.

Perhaps what you want is something like eval("r'%s'" % (raw_input(),)), 
assuming no ' or " in user input.

Terry J. Reedy



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to