path backslash escaping trouble

Sion Arrowsmith siona at
Tue Jul 10 14:02:11 CEST 2007

placid  <Bulkan at> wrote:
>I have these files; [ ... ]
>CodeReview::::FirstName LastName::::
>i read this whole file into a string so i can search for the value of
>Elements which is
>but this path is escaped

How are you reading the file in? Are you absolutely sure that the
escaping appears *in the string*, and isn't being done by whatever
you're using to inspect it?

>>> s = open('/tmp/Elements').read()
>>> s
>>> len(s)

Now, if those backslashes had *really* been escaped, the string would be
length 77, wouldn't it?

>>> s.find('\\\\')

And find() can't find any double-backslashes in there.

\S -- siona at --
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

More information about the Python-list mailing list