获取本地不同的目录格式

#!/usr/bin/env Python3
# -*- coding: utf-8 -*-
# @Software: PyCharm
# @virtualenv:workon
# @contact: contact information
# @Desc:Code descripton
__author__ = '未昔/AngelFate'
__date__ = '2019/8/18 16:03'


import os
current_dir = os.path.abspath(os.path.dirname(__file__))
print(current_dir) #E:\python\RPA\spdb\cw\分解操作

current_dir1 = os.path.dirname(__file__)
print(current_dir1) #E:/python/RPA/spdb/cw/分解操作

parent_path = os.path.dirname(current_dir1)
print(parent_path) #E:/python/RPA/spdb/cw

parent_path1  = os.path.dirname(parent_path)
print(parent_path1) #E:/python/RPA/spdb

parent_path2 = os.path.dirname(current_dir)
print(parent_path2) #E:\python\RPA\RPA\spdb