is_file:判断文件是否存在
is_dir:判断目录是否存在
file_exists:判断文件/目录是否存在
速度比较
is_file/is_dir | file_exists | |
---|---|---|
当目标文件/目录存在时 | 较快 | 较慢 |
当目标文件/目录不存在时 | 相同 | 相同 |
is_file:判断文件是否存在
is_dir:判断目录是否存在
file_exists:判断文件/目录是否存在
is_file/is_dir | file_exists | |
---|---|---|
当目标文件/目录存在时 | 较快 | 较慢 |
当目标文件/目录不存在时 | 相同 | 相同 |