I want to check if a file exists. So I use the following code :
if os.path.exists(filepath + "Piezometrie.xlsx"):
    try :
       # do something
    else:
        pass
When I want to check if a file contains some specific characters, I use :
piezo = filepath + "Piezometrie.xlsx"
texte = "zom"
if re.search(texte, piezo):
    print "ok"
else:
    print "ko"
But how could I do to check if a file that contains specific characters (like "zom" in this example) exists (by using regex) ?
Thank you very much !
Julien
 
    