import os os.path.exists(test_file.txt) #True os.path.exists(no_exist_file.txt) #False
# try: # f =open('1.txt','r',encoding='utf-8') # f.close() # except IOError: # print("File is not accessible.") # else: # print('存在')