获取Python 脚本的所在目录
来源:互联网 发布:淘宝花卉种子 编辑:程序博客网 时间:2024/06/05 16:30
获取Python 脚本的所在目录
Tips: 一些工程开发中,使用相对路径,能提高工程的可移植性(如Python/shell的脚本工程)
- 获取Python脚本的所在目录的方法
You need to call os.path.realpath on file, so that when file is a filename without the path you still get the dir path:
import osprint os.path.dirname(os.path.realpath(__file__))
- 参考链接
0 0
- 获取Python 脚本的所在目录
- Python获取脚本所在目录
- python 获取运行python脚本所在目录
- Python获取脚本所在目录的正确方法
- Python获取脚本所在目录的正确方法
- Python获取脚本所在目录的正确方法
- python 获取脚本所在目录的正确方法
- [转]python 获取脚本所在目录
- Python获取脚本所在目录路径
- shell 获取脚本所在目录的方法
- 获取shell脚本自身所在目录的Shell脚本分享
- python获得Python脚本所在目录的位置的 【坑】
- Python获取程序所在目录
- Shell使用笔记-获取当前脚本所在的目录
- Linux shell获取执行脚本文件所在的目录
- lua中获取当前脚本所在的目录debug.getinfo()
- Shell中获取脚本所在目录绝对路径的方法
- bat脚本获取当前文件所在目录
- Java的JDK和JRE
- Java transient关键字使用小记
- WebService的两种方式Rest和Soap方式
- Qt5 QRegExp正则替换文本
- Scala 一些便捷文本操作
- 获取Python 脚本的所在目录
- tp小型网站优化
- css:float浮动
- MySQL优化存储IP地址
- 记录一些小点 [随时更新] [神犇勿进] (1)
- Linux学习之if语句
- Spring 源码下载---从github导入源码到idea
- 加油,今天开始,希望每天都有一点点进步!
- 浅谈C语言中的布尔(bool)类型