how do i check if a file exists with python?
Moshe Zadka
moshez at zadka.site.co.il
Sun Dec 31 10:39:21 EST 2000
More information about the Python-list mailing list
Sun Dec 31 10:39:21 EST 2000
- Previous message (by thread): how do i check if a file exists with python?
- Next message (by thread): i wanna join the python newsgroup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 29 Dec 2000 14:02:25 GMT, ullrich at math.okstate.edu (David C. Ullrich) wrote: > On Fri, 29 Dec 2000 16:54:56 +0200 (IST), Moshe Zadka > >Now, it may be that I'm wrong, in which > >case just go ahead an use os.path.isfile > It's certainly true the the second foo is better than the first, > in fact yes the first is evil. But there are other reasons a person > might want to know whether a file exists (although probably > things like foo are the most likely explanation.) You seemed to miss the above part of my posting. While not having used isfile, I've frequently used isdir to my advatage before. > I sometimes make cumulative backups of files containing > important stuff. I sort of need to determine that file.001, > file.002 and file.003 already exist and file.004 does not > before deciding what to name the current backup file. That's *really* evil. What if there is another version of your process running??? Damn!, just lost that backup file. In that case, I'd go for a Maildir-like algorithm, which promises no colisions. Actually, in that case, usually what you want is CVS, but that's a matter for another day. > (When I tell people they're asking the wrong question I > get in trouble for it...) You're safe with us, buddy. as-long-as-you-pay-your-protection-fee-in-time-ly y'rs, Z. -- Moshe Zadka <sig at zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses!
- Previous message (by thread): how do i check if a file exists with python?
- Next message (by thread): i wanna join the python newsgroup
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list