H
Harry George
Peter Hansen said:It does not, although *you* are not escaping the backslash
yourself, and that is dangerous. Get in the habit of always
escaping your own backslashes, so that if you ever happen
to use a backslash followed by one of the characters which _is_
a valid escape sequence, you won't get confused.
'\/' == '\\/'
but
'\t' != '\\t'
The first example shows two ways of writing a string with the blackslash
character followed by a forward slash. The second example shows a TAB
character on the left, but a backslash plus the letter 't', on the right.
As for your apparent automatic escaping of backslashes: when you show
results in an interactive session by just typing the expression, such as
when you do ">>> s" you will see the repr() of the value, not the actual
content. Use print instead and you'll see the difference:
This is all covered pretty well, I think, by the Python tutorials and
such. Have you gone through those?
-Peter
Did someone already mention os.path? Since this is about filenames,
that is the best cross-platform colution.