I need to check the current directory and see if a file with an extension exists. My setup will (usually) only have one file with this extension. I need to check if that fil
If you only want to check that any file ends with a particular extension, use any.
any
import os if any(File.endswith(".true") for File in os.listdir(".")): print("true") else: print("false")