1import os
2
3os.path.exists("file.txt") # Or folder, will return true or false
1import os
2filename = "creating file with python function"#your file name
3print("Do ",filename," exists:- ",os.path.exists(filename))
1import os
2filename = "creating file with python function"#your file name
3print("Is",filename,"a file",os.path.isfile(file_oprator))