python raw strings?

Maurice LING mauriceling at acm.org
Wed Aug 25 06:55:52 CEST 2004


Thanks. I find http://www.amk.ca/python/howto/regex/ to be invaluable in 
understanding the concepts.

maurice

Maurice LING wrote:
> 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