Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

python 如何得到 .py檔案本身自己的檔名

IamTest.py 檔案內容:

輸入指令執行:
python workspace\tmp\IamTest.py

輸出如下:
__file__: workspace\tmp\IamTest.py
Filename: IamTest.py
sys.argv[0]: workspace\tmp\IamTest.py

發表迴響