Learing Python, Newbie question

Markus Jais mjais at web.de
Thu Oct 25 12:19:59 CEST 2001


In article <MPG.1641f801932af151989686 at news.t-online.de>, "Johannes
Gamperl" <info at devshare.de> wrote:

> Hello,
> 
> i just starting to learn python ... so i've two questions:
> 
> 1. is there a easy way to test, if a file exists? 

use the os module

import os

if os.path.exists("path_fo_file"):
    print "yes"


you can find out more about this at:
http://www.python.org/doc/current/lib/module-os.path.html


markus



More information about the Python-list mailing list