Answers for "how to get current filename in python"

11

python get current file location

import os
os.path.dirname(os.path.abspath(__file__))
Posted by: Guest on May-11-2020
2

python name of current file

from pathlib import Path
print(Path(__file__).stem) #myfile
print(Path(__file__).name) #myfile.py
Posted by: Guest on April-23-2021

Code answers related to "how to get current filename in python"

Python Answers by Framework

Browse Popular Code Answers by Language