os.path.exists() for files in your Path?

前端 未结 5 2044

I commonly use os.path.exists() to check if a file is there before doing anything with it.

I\'ve run across a situation where I\'m calling a executable that

5条回答
  •  别跟我提以往
    2021-02-04 07:46

    You generally shouldn't should os.path.exists to try to figure out if something is going to succeed. You should just try it and if you want you can handle the exception if it fails.

提交回复
热议问题