os.remove("test.txt") #删除指定文件
print "n删除成功";
else:
print "n文件不存在";
print "咱们来删除一个文件,删除后的结果:";
print os.listdir(path);
print "n查看您的ip:n";
print os.system("ipconfig"); #执行系统命令
filepath1="C:Python27";
filepath2="C:Python27os.py";
if(os.path.isfile(filepath2)): #判断是不是文件
print filepath2+"是一个文件";
if(os.path.isfile(filepath1)):
print filepath1+"是一个文件";
else:
print filepath1+"不是一个文件";
name="os.py";
print "本程序的大小为";
print os.path.getsize(name); #获取文件大小
name=os.path.abspath(name); #获取文件的绝对路径
print "本程序的绝对路径是"+name;
print "本程序的路径的文件名分别为:";
print os.path.split(name); #将文件名和路径分开










