[Tutor] file exists question

Alan Gauld alan.gauld at btinternet.com
Mon Mar 9 17:50:11 CET 2015


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 relative to
the cwd or absolute.

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list