首页 > 编程语言 > 详细

python模块、包引入

时间:2018-09-03 13:02:27      阅读:199      评论:0      收藏:0      [点我收藏+]

 

 

# 方法一:
cur_root = os.path.split(os.path.abspath(__file__))[0]  # 当前模块绝对目录
# 方法二:
import inspect
cur_root = os.path.split(inspect.getfile(inspect.currentframe()))[0]  # 当前模块绝对目录

father_path=os.path.abspath(os.path.dirname(cur_root)+os.path.sep+".")  # 当前模块父目录
grader_father=os.path.abspath(os.path.dirname(cur_root)+os.path.sep+"..")  # 当前模块父目录的父目录

  

  

 

python模块、包引入

原文:https://www.cnblogs.com/lxfnote/p/9577763.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!