os.path.join()
将分离的部分合成一个整体
filename=os.path.join('/testuser/path_test','join_test')
print(filename)
os.path.splitext()
将路径和拓展名分开
fname,fename=os.path.splitext('/testuser/path_test/split_test.py')
print(fname)
print(fename)
os.path.split()
返回文件路径和文件名
dirname,fname=os.path.split('/testuser/path_test/split_test.py')
print(dirname)
print(fname)
os.path.basename()
返回路径最后的文件名
filename = os.path.basename('/testuser/path_test')
print(filename)
filename = os.path.basename('/testuser/path_test/split_test.py')
print(filename)