os.unlink on Windows

Shambhu shambhu.1980 at gmail.com
Mon Aug 9 00:57:30 EDT 2010


Hi Thomas, Steven,
                      Thanks for explanation. It is working now after
using double backslash in pathname. I was misinterpreting the display
output and thinking that it was being added by 'os' module.

Regards,
Shambhu.

                 T
On Aug 8, 6:29 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Sun, 08 Aug 2010 04:41:14 -0700, Shambhu wrote:
> > Hi Thomas,
>
> >            I checked, file is present. Here is my sample script:
> > import os
> > filename = "C:\SHAMBHU\tmp\text_delete.txt"
>
> Did you intend to provide a filename with two TAB characters in it?
>
> c colon backslash s h a m b u TAB m p TAB e x t underscore d e l e t e
> dot t x t
>
> > File "C:\SHAMBHU\tmp\text_delete.txt" is accessible but "C:\\SHAMBHU\
> > \tmp\\text_delete.txt" is not (with extra backslash in path which is
> > added by os.unlink).
>
> os.unlink does add any extra backslashes. You are misinterpreting what
> you are seeing.
>
> --
> Steven




More information about the Python-list mailing list