print(os.path.dirname(__file__)) #返回目录路径 print(os.path.abspath(__file__)) #返回文件路径 print(os.path.join(os.path.dirname(__file__), "report", "report.txt")) #拼接路径 report = os.path.join(os.path.dirname(__file__), "report", "report.txt")#拼接路径 print(os.path.exists(report)) #判断文件是否存在