python raw strings?

Maurice LING mauriceling at acm.org
Tue Aug 24 18:55:37 EDT 2004


I'm trying to toy around with PLY (python lex-yacc) by David Beazley 
from University of Chicago and realized that the lex module uses python 
raw strings. What are python raw strings and how are they different from 
regular strings? I've tried to look up in the python documentation but 
it just vaguely brushes through by saying that python raw strings are 
prefixed with "r" or "R".

In PLY, "+" is "r'\+'" but "-" is "r'-'", why is there an extra "\" in 
"+"? When to use the extra "\" and when not?

Can someone point me in the correct direction?

Thanks
Maurice



More information about the Python-list mailing list