If you want to open the file for writing just open it with append mode. open(¨filename", "a"). If it doesn't exist - it'll create it, and if it does it'll start appending to the file
For reading - os.path.exists("filename"). Or (doesn't make much sense, but still) try to open it for reading and python will throw an IOException which you can catch and handle. Michael --- John Salerno <[EMAIL PROTECTED]> wrote: > What is the best way to check if a file already > exists in the current > directory? I saw os.path.isfile(), but I'm not sure > if that does more > than what I need. > > I just want to check if a file of a certain name > exists before the user > creates a new file of that name. > > Thanks. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list