Difference between os.path.exists and os.path.isfile?

后端 未结 2 1966
余生分开走
余生分开走 2020-12-10 00:27

I\'m curious when these two functions will return different values. Also if you could clarify the difference between a path/directory/file that would be appreciated.

2条回答
  •  时光取名叫无心
    2020-12-10 01:10

    A directory tests true for exists, but false for isfile. There are a few different types of filesystem objects for which that is also true.

    isfile means that it is a regular file. It is more specific than exists.

提交回复
热议问题