您的位置:首页 > 编程语言 > Python开发

paip.判断文件是否存在uapi python php java c#

2014-04-12 22:41 489 查看
paip.判断文件是否存在uapi python php java c#

==========uapi

file_exists

exists()

面向对象风格: File.Exists

作者: 老哇的爪子Attilax 艾龙, EMAIL:1466519819@qq.com

来源:http://blog.csdn.net/attilax

========python

python如何判断一个目录下是否存在某个文件??..._百度知道



使用os.path.exists()方法可以直接判断文件是否存在。

代码如下:

>>> import os

>>> os.path.exists(r'C\1.TXT')

=========php file_exists("data.txt")

==========java

public static boolean file_exists(String newPath) {

File file=new File(newPath);

return( file.exists()) ;

}

=====c#

if(File.Exists(@"文件路径"))

{

//存在

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: