How do I get the path of the current executed file in Python?
2017-01-03 16:45
435 查看
First, you need to import from
Next, wherever you want to find the source file from you just use
ref: http://stackoverflow.com/questions/2632199/how-do-i-get-the-path-of-the-current-executed-file-in-python[/code]
inspectand
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[/code]
相关文章推荐
- string - How to get the filename without the extension from a path in Python? - Stack Overflow
- How to get the size of file in C++ - 在C++中如何获取文件的大小
- How to Get the Length of File in C
- How to get the content of the 'identity' section in web.config
- Get and display the size of file and directory in Linux system using du command 获取和现实linux文件大小(三)
- flex/in the datagrid,how to get the new value of cell in the datagrid after edit
- How To Get Application Path,And How To Get The Path's Directory,File Name,And Type Info(如何得到运行程序的路径,以及如何得到路径的文件夹,文件名,以及类型等等信息)
- How can I get the IPv4 address of an interface in linux from C code ?
- How to get the query statement of LOV in Oracle Form
- Use Flex and JavaScript to get the full path of a local File
- how to get the space size of some tables in one database?
- How to get the number of pages in a Word Document
- How to get the Diagnostic data and debug file of Sales Order pick release
- how to get the return value from a thread in python?
- How to get the IIS root path in other application.
- [Tutor] how to change the current working directory path in ipython.
- How Would You Get the Count of an Array in C++?
- 在C++中怎样获得数组的大小?(原文标题:How Would You Get the Count of an Array in C++?)
- How to calculate the MD5 hash of a large file in C?
- How to resolve errors opening currentsettings.vssettings in the final release of VS 2008