Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 744 Bytes

Python_00008_20161121.md

File metadata and controls

42 lines (27 loc) · 744 Bytes

变更记录

序号 录入时间 录入人 备注
1 2016-11-21 Alfred Jiang -

方案名称

Python - 常用文件操作功能函数收集

关键字

Python \ 文件操作 \ 功能函数

需求场景

  1. 用于文件统计收集功能的函数收集

参考链接

(无)

详细内容

获取当前 Python 脚本文件所在目录路径
#获取脚本文件的当前路径
def current_file_dir():
     
     path = sys.path[0]
     
     if os.path.isdir(path):
         return path
     elif os.path.isfile(path):
         return os.path.dirname(path)

效果图

(无)

备注

(无)