Actually, this doesn't work. The string you show has two characters,
both of them backslashes. The r prefix means that backslashes aren't
escapes, they're literal backslash characters. Unfortunately, there's a
flaw in the Python lexer which means you can't use a single backslash
here either:
>>> r'\\'
'\\\\'
>>> r'\'
File "<stdin>", line 1
r'\'
^
SyntaxError: EOL while scanning single-quoted string
>>>
--Ned.
Leeland (The Code Janitor) wrote:
> I would use a raw string like this"
>
> string.rfind(r'\\')
>
> The raw string makes sure there is no additional escaped special
> characters. But you still need to escape the backslash.
>
> Here is a good read on all this:
> http://www.python.org/doc/current/ref/strings.html
>
> + Leeland
> >
>
>
>
--
Ned Batchelder, http://nedbatchelder.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---