Ernesto wrote:
> I couldn't find this with a search, but isn't there a way to overwrite
> a previous folder (or at least not perform osmkdir( ) if your program
> detects it already exists).  Thanks !

Would something like this help?

import os

def failsafe_mkdir(dirname):
        try:     os.mkdir(dirname)
        except:  return False
        else:    return True


if __name__ == "__main__":
        dirname = 'adir'
        if failsafe_mkdir(dirname):
                print "ok\n"
        else:
                print "couldn't create %s\n" % dirname
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to