import os if any(File.endswith(".txt") for File in os.listdir(".")): print("true") else: print("false")