os.unlink on Windows

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Aug 8 09:29:43 EDT 2010


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