[Tutor] file exists question

Steven D'Aprano steve at pearwood.info
Thu Mar 12 02:49:06 CET 2015


On Mon, Mar 09, 2015 at 08:51:52PM -0500, Zachary Ware wrote:
> On Mar 9, 2015 7:25 PM, "Steven D'Aprano" <steve at pearwood.info> wrote:
> > What I really want is an option to open() that only
> > opens a new file, and fails if the file already exists.
> 
> If I'm not mistaken, this is the 'x' open mode, added in Python 3.4 (or
> maybe 3.3, I forget).

That's exactly what I want!

Thanks for pointing that out.


-- 
Steve


More information about the Tutor mailing list