In article ,
Christian Heimes wrote:
> Am 11.12.2010 18:04, schrieb Roy Smith:
> > if os.access("file", os.F_OK):
> >os.unlink("file")
> >
> > but that's annoying too. What would people think about a patch to
> > os.unlink() to add an optional second parameter which says to ignore
> > at
On Sat, Dec 11, 2010 at 10:34 PM, Roy Smith wrote:
> os.unlink("file", ignore=True)
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Take a look at shutil.rmtree
http://docs.python.org/library/shutil.html?highlight=shutil#shutil.rmtree
--
Thanks & Regards,
Godson Gera
Python Consu
On Sat, 11 Dec 2010 12:04:01 -0500, Roy Smith wrote:
> I just wrote an annoying little piece of code:
>
> try:
> os.unlink("file")
> except OSError:
>pass
>
> The point being I want to make sure the file is gone, but am not sure if
> it exists currently. Essentially, I want to do what "
Am 11.12.2010 18:04, schrieb Roy Smith:
> if os.access("file", os.F_OK):
>os.unlink("file")
>
> but that's annoying too. What would people think about a patch to
> os.unlink() to add an optional second parameter which says to ignore
> attempts to remove non-existent files (just like "rm -f"
I just wrote an annoying little piece of code:
try:
os.unlink("file")
except OSError:
pass
The point being I want to make sure the file is gone, but am not sure if
it exists currently. Essentially, I want to do what "rm -f" does in the
unix shell.
In fact, what I did doesn't even do th