python os模块判断文件是否存在,file_path获取当前文件路径
import os file_path = os.path.dirname(__file__) os.path.exists(test_file.txt)
多思考也是一种努力,做出正确的分析和选择,因为我们的时间和精力都有限,所以把时间花在更有价值的地方。
import os file_path = os.path.dirname(__file__) os.path.exists(test_file.txt)