实例如下:
1
2
3
4
5
6
7
8
|
import os
if __name__ = = "__main__" :
file_path = 'D:/test/test.apk'
parent_path = os.path.dirname(file_path)
print ( 'parent_path = %s' % parent_path)
file_name = os.path.split(file_path)[ - 1 ]
print ( 'file_name = %s' % file_name)
|
输出: