Learing Python, Newbie question

Johannes Gamperl info at devshare.de
Thu Oct 25 06:22:39 EDT 2001


Hello Markus,

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

thx a lot .. this works fine. Do you know if there is a 
coditional operator in python ( ?: )

e.g.

if os.path.exists("gbook.txt"):
  db_first = 0;
else:
  db_first = 1;


db_first = ( os.path.exists("gbook.txt") ) ? 0:1;


So long ... 
Hannes



More information about the Python-list mailing list