0)涉及的包
import os
1)得到一个目录下的所有文件
files = os.listdir(_dir)
2) 获得一个文件的绝对路径
_file = os.path.abspath(_file)
3) 获得一个文件所在的目录
_dir = os.path.dirname(_file)
4) 文件路径分割
# _dir = /a/b/c
# items = ['/a/b', ‘c’]
items = os.path.split(_dir)
5) 文件路径连接
path = os.path.join(_dir, _file)