All pastes #816171 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-12-14 17:59 UTC
rendered paste body
(work)(~) $ cat remove 
import os
file = "/tmp/toremove"

if os.path.exists(file):
    print "trying to remove... ",
    if os.remove(file):
        print "yes"
    else:
        print "no"
else:
    print "it does not exist"

(work)(~) $ touch /tmp/toremove
(work)(~) $ ls /tmp/toremove 
/tmp/toremove
(work)(~) $ python remove
trying to remove...  no
(work)(~) $ ls /tmp/toremove
ls: /tmp/toremove: No such file or directory
(work)(~) $