aleaxit at yahoo.com
Fri Oct 22 21:20:30 CEST 2004
Luis P. Mendes <luisXX_lupe2XX at netvisaoXX.pt> wrote:
> I've already read many pages on this but I'm not able to separate the
> string 'R0\1.2646\1.2649\D' in four elements, using the \ as the separator.
x = r'R0\1.2646\1.2649\D'
elements = x.split('\\')
> and why must I write two '' after the \? If I hadn't used r I would
A raw literal can't end with an odd number of backslashes (_some_ way
has to be there to escape the quote char, after all).
> how should I do it?
I think the string's split method, as above, is the simplest, fastest
More information about the Python-list