RPA手把手——获取本地不同的目录格式

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_44447687/article/details/102390373

艺赛旗 RPA10.0全新首发免费下载 点击下载

http://www.i-search.com.cn/index.html?from=line1

#!/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

猜你喜欢

转载自blog.csdn.net/weixin_44447687/article/details/102390373