python open does not create file if it doesnt exist
- by Toddeman
I am using Python.
What is the best way to open a file in rw if it exists, or if it does not, then create it and open it in rw? From what i read, file = open('myfile.dat', 'rw') should do this, no? it is not working for me (python 2.6.2) and im wondering if it is a version problem, or not supposed to work like that or what.
The bottom line is, i just need a solution for the problem. I am curious about the other stuff, but all i need is a nice way to do the opening part.
thanks in advance