Cody Bable

Generation

generate functionThu, 20 Apr 2023

try...except block checking if a file exist

def checkFileExist(file, path): try: with open(os.path.join(path, file)) as f: return True except FileNotFoundError: return False

Want to kickstart your project?Use the new AI Studio to create your code