python split(),os.path.split()和os.path.splitext()函数用法
#os.path.join() 将分离的部分合成一个整体filename=os.path.join('/home/ubuntu/python_coding','split_func')
print filename
#输出为:/home/ubuntu/python_coding/split_func
#os.path.splitext()将文件名和扩展名分开
fname,fename=os.path.splitext('/home/ubuntu/python_coding/split_func/split_function.py')
print 'fname is:',fname
print 'fename is:',fename
#输出为:
# fname is:/home/ubuntu/python_coding/split_func/split_function
#fename is:.py
#os.path.split()返回文件的路径和文件名
dirname,filename=os.path.split('/home/ubuntu/python_coding/split_func/split_function.py')
print dirname
print filename
https://blog.csdn.net/T1243_3/java/article/details/80170006
页:
[1]