我正在我的一个脚本中使用以下检查:
if os.path.exists(FolderPath) == False:
print FolderPath, 'Path does not exist, ending script.'
quit()
if os.path.isfile(os.path.join(FolderPath,GILTS)) == False:
print os.path.join(FolderPath,GILTS), ' file does not exist, ending script.'
quit()
df_gilts = pd.read_csv(os.path.join(FolderPath,GILTS))
足够稳定的是,当路径/文件不存在时,我获得以下打印:
IOError: File G:\On-shoring Project\mCPPI\Reconciliation Tool\Reconciliation Tool Project\3. Python\BootStrap\BBG\2017-07-16\RAW_gilts.csv does not exist
告诉我,即使我添加了quit(),脚本仍在继续。谁能告诉我为什么?
谢谢