import ospath = /path/to/dirroot,dirs,files = os.walk(path).next()if myfile in files: print "yes it exists"
This is helpful when checking for several files. Or you want to do a set intersection/ subtraction with an existing list.
import ospath = /path/to/dirroot,dirs,files = os.walk(path).next()if myfile in files: print "yes it exists"
This is helpful when checking for several files. Or you want to do a set intersection/ subtraction with an existing list.