今からでも間に合う

技術を学ぶのは今からでも遅くない

python入門~ファイル・ディレクトリの存在確認~

ファイル・ディレクトリの存在を確認するためには、標準ライブラリosos.path.exitsts()を使用します。

import os
  
dir = r"c:\hoge"
file = r"c:\hoge\piyo.txt"
  
if os.path.exitsts(dir):
    pass
if os.path.exitsts(file):
    pass

python入門Top

プライバシーポリシー


d払いポイントGETモール