如果您只是想單純檢查檔案存在與否,沒有需要馬上開啟的話,可以使用 os.path.isfile : import os # 要檢查的檔案路徑 filepath = "/etc/motd" # 檢查 ...
確定! 回上一頁