How do I get the path of the current executed file in Python?
First, you need to import from inspect and os
from inspect import getsourcefile
from os.path import abspath
Next, wherever you want to find the source file from you just use
abspath(getsourcefile(lambda:0))
ref: http://stackoverflow.com/questions/2632199/how-do-i-get-the-path-of-the-current-executed-file-in-python
How do I get the path of the current executed file in Python?的更多相关文章
- python如何使用 os.path.exists()--Learning from stackoverflow 分类: python 2015-04-23 20:48 139人阅读 评论(0) 收藏
Q&A参考连接 Problem:IOError: [Errno 2] No such file or directory. os.path.exists() 如果目录不存在,会返回一个0值. ...
- 2.2.5 NIO.2 Path 和 Java 已有的 File 类
NIO与IO交互 toPath() File -- Path toFile() Path -- File Demo: import java.io.File; import java.nio.file ...
- 【LeetCode】847. Shortest Path Visiting All Nodes 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址: https://leetcode.com/problems/shortest ...
- 【LeetCode】329. Longest Increasing Path in a Matrix 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址: https://leetcode.com/problems/longest- ...
- Description Resource Path Location Type AndroidManifest.xml file missing!
这个问题又找了好久.国内回答的确不敢恭维. 本回答来自谷歌: This is build issue. Go to Menu in eclipse, Project>clean then P ...
- CDN(翻译)
http://dojotoolkit.org/documentation/tutorials/1.10/cdn/index.html 从CDN上加载dojo模块时非常有用的.从CDN上加载Dojo并同 ...
- 29 A Quick Guide to Go's Assembler 快速指南汇编程序:使用go语言的汇编器简介
A Quick Guide to Go's Assembler 快速指南汇编程序:使用go语言的汇编器简介 A Quick Guide to Go's Assembler Constants Symb ...
- Nodejs:Path对象
模块Path: path.normalize(url) path.join(url1, url2, ..) path.resolve(url1, url2, ..) path.relative(url ...
- [python] os.path说明
os.path - Common pathname manipulations操作 This module implements some useful functions on pathnames. ...
随机推荐
- Python学习--Python简介
Python 简介 Python是一种解释型.编译性.面向对象.动态数据类型的高级程序设计语言.Python由Guido van Rossum于1989年底发明,第一个公开发行版发行于1991年. P ...
- 如何使用PullToRefresh
这里有详解 PullToRefresh使用详解(一)--构建下拉刷新的listView PullToRefresh使用详解(二)---重写BaseAdapter实现复杂XML下拉刷新 PullToRe ...
- Masonry tableviewCell布局(转)
转载自:http://www.henishuo.com/masonry-tableviewcell-layout/ 前言 说到iOS自动布局,有很多的解决办法.有的人使用xib/storyboard自 ...
- form表单提交时,action怎么带参数
<html> <title>form</title> <script type="text/javascript"> functio ...
- time step和采样频率的关系
当前的采样频率为11025HZ,overlap=0.5,取的是1024个采样点为1帧.则time step为256时的时间长度为11秒.即以11秒为单位分割原始的音频,生成一张语普图. >> ...
- form表单序列化后的数据转json对象
function formToJson(){ var data = $("#form").serialize(); data= decodeURIComponent(data,tr ...
- Redis 3.0.5 集群的命令、使用、维护
cluster命令 CLUSTER INFO 打印集群的信息 CLUSTER NODES 列出集群当前已知的所有节点(node),以及这些节点的相关信息. //节点 CLUSTER MEET < ...
- Swift中类与结构的初始化
前言:通过学习与研究swift3.0的官方文档关于初始化这部分可以总结为一句话:类与结构是确保一个类型的实例可以使用之前,其所有存储属性都得到了正确的赋值. 一,结构的初始化1 struct Firs ...
- ubuntu安装/卸载mysql
1.安装mysql root@openstack001:/tmp# apt-get install mysql-server Reading package lists... Done Buildin ...
- telnet模拟邮件发送
前提:Telnet命令可用 问题:提示不是内部命令: 解决办法:控制面板->程序和功能->打开或关闭Windows功能,把Telnet客户端勾上即可: 步骤: telnet smtp.al ...