import os
system =os.name
if system == 'nt':
    print('当前的操作系统是windows')
else:
    print('当前的操作系统是Linux')
    
print('本系统表示路径的分隔符是:',os.sep)
print('本系统的行终止符为:',[os.linesep])

path=os.getcwd()
print('运行本程序所在的目录是:',path)
print('计算机的Path环境变量如下所示',os.getenv("Path"))

os.mkdir("test")
print('当前文件夹中的文件有:\n',os.listdir(path))
if(os.path.exists("test")):
    os.rmdir("test")
    print('删除文件夹')
else:
    print('文件夹不存在')
print('删除后的结果:\n',os.listdir(path))
filepath1 ="python7"
if(os.path.isfile(filepath1)):
    print(filepath1+"是一个文件")
else:
    print(filepath1+"不是一个文件")
    
name = "test1.py"
print('本程序的大小为',os.path.getsize(name))
name=os.path.abspath(name)
print('本程序的绝对路径是'+name)
print('本程序的路径的文件名分别为',os.path.split(name))
files =os.path.splitext(name)
print('本程序的扩展为'+files[1])
print('本程序的文件名为'+os.path.basename(name))
print('本程序的路径为'+os.path.dirname(name))