2018年1月8日 星期一

Python: Get the path and name of the file that is currently executing

Python: Get the path and name of the file that is currently executing

Python Basic: Exercise-46 with Solution

Write a python program to get the path and name of the file that is currently executing.
Sample Solution:-
import os
print("Current File Name : ",os.path.realpath(__file__))

========== RESTART: F:/Python_APSC/py-ex-basic-46.py ==========
Current File Name :  F:\Python_APSC\py-ex-basic-46.py
>>> 

沒有留言:

張貼留言

OPEN DATA AQI 空氣品質監測網 + NODE-RED

OPEN DATA AQI 空氣品質監測網 + NODE-RED  首頁 - 空氣品質監測網  https://airtw.moenv.gov.tw/ https://data.gov.tw/datasets/search?p=1&size=10&s=_score...