Steve Willoughby wrote:
Johan Nilsson wrote:
In [74]: p.findall('asdsa"123abc\123"jggfds')
Out[74]: ['"123abcS"']

By the way, you're confusing the use of \ in strings in general with the use of \ in regular expressions and the appearance of \ as a character in data strings encountered by your Python program.

When you write the code:

p.findall('asdsa"123abc\123"jggfds')

the character string 'asdsa"123abc\123"jggfds' contains the special code \123 which means "the ASCII character with the octal value 123". That happens to be the letter S. So that's the same as if you had typed:

p.findall('asdsa"123abcS"jggfds')

which may explain your results.

using a raw string would have solved that problem.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to