os.path.dirname(path) 语法:os.path.dirname(path) 功能:去掉文件名,返回目录 如:print(os.path.dirname("E:/Read_File/read_demo.py"))#结果:E:/Read_File