如何判断一个文件是否存在?

不想用 try 语句,如何判断一个文件是否存在?

答案是:

import os.path
os.path.isfile(file_name)

Last updated