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
>>> 

沒有留言:

張貼留言

ASK 調變模擬器程式碼

ASK 調變模擬器程式碼 為什麼第二張圖要「放大 (Zoom)」? 1 kHz  的週期是 1000 us 。 如果不放大,第二張圖會因為波形太密而看起來像一塊實心的紅磚。 import tkinter as tk from tkinter import ttk import n...