ファイル・ディレクトリの存在を確認するためには、標準ライブラリos
のos.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
ファイル・ディレクトリの存在を確認するためには、標準ライブラリos
のos.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