Re: [Tutor] file exists question

2015-03-11 Thread Steven D'Aprano
On Mon, Mar 09, 2015 at 08:51:52PM -0500, Zachary Ware wrote: > On Mar 9, 2015 7:25 PM, "Steven D'Aprano" 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

Re: [Tutor] file exists question

2015-03-09 Thread Zachary Ware
On Mar 9, 2015 7:25 PM, "Steven D'Aprano" 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). -- Zach _

Re: [Tutor] file exists question

2015-03-09 Thread Oscar Benjamin
On 10 March 2015 at 00:22, Steven D'Aprano wrote: > On Mon, Mar 09, 2015 at 04:50:11PM +, Alan Gauld wrote: >> >> Somebody posted a question asking how to fond out if a file >> exists. The message was in the queue and I thought I'd approved >> it but it hasn't shown up yet. Sorry to the OP if

Re: [Tutor] file exists question

2015-03-09 Thread Steven D'Aprano
On Mon, Mar 09, 2015 at 04:50:11PM +, Alan Gauld wrote: > Somebody posted a question asking how to fond out if a file > exists. The message was in the queue and I thought I'd approved > it but it hasn't shown up yet. Sorry to the OP if I've messed up. > > The answer is that you use the os.path

Re: [Tutor] file exists question

2015-03-09 Thread Wolfgang Maier
On 09.03.2015 18:50, David Heiser wrote: On 3/9/2015 9:50 AM, Alan Gauld wrote: Somebody posted a question asking how to fond out if a file exists. The message was in the queue and I thought I'd approved it but it hasn't shown up yet. Sorry to the OP if I've messed up. The answer is that you

Re: [Tutor] file exists question

2015-03-09 Thread David Heiser
On 3/9/2015 9:50 AM, Alan Gauld wrote: Somebody posted a question asking how to fond out if a file exists. The message was in the queue and I thought I'd approved it but it hasn't shown up yet. Sorry to the OP if I've messed up. The answer is that you use the os.path.exists() function. It take

[Tutor] file exists question

2015-03-09 Thread Alan Gauld
Somebody posted a question asking how to fond out if a file exists. The message was in the queue and I thought I'd approved it but it hasn't shown up yet. Sorry to the OP if I've messed up. The answer is that you use the os.path.exists() function. It takes a path as an argument which can be relat