How to delete this file ???

Peter Hansen peter at engcorp.com
Mon Dec 1 22:57:34 CET 2003


DCK wrote:
> 
> Hello again
> Really sorry for long time between me letters. All problem gone, after i've
> used raw string (r"\\path\to\any\file") Really thanks for all answers :)

Note that it's almost always better to use forward slashes instead.

In this case, "//path/to/any/file" would work wonderfully, and is much
more readable.

Yes, it does work with Windows.  The only time it doesn't is when using
command line programs which interpret the forward slash as an option,
and insist on backslashes.

(An unfortunate additional area is that os.path for Windows normalizes
things to use backslashes, and therefore path comparisons can get a little
tricky if you use forward slashes but aren't careful about normalizing
with os.path.normpath() all the time.)

-Peter




More information about the Python-list mailing list