Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get current file location

import os
os.path.dirname(os.path.abspath(__file__))
Comment

get current file name python

import os
os.path.basename(__file__)
Comment

python name of current file

from pathlib import Path
print(Path(__file__).stem) #myfile
print(Path(__file__).name) #myfile.py
Comment

PREVIOUS NEXT
Code Example
Python :: numpy read image 
Python :: django add media 
Python :: rotate x label 90 degrees seaborn 
Python :: how to save a png seaborn pandas 
Python :: How to generate the power set of a given set, in Python? 
Python :: python distance between coordinates 
Python :: bee movie script 
Python :: plot function in numpy 
Python :: timestamp to date python 
Python :: pygame draw line 
Python :: python3 base64 encode basic authentication 
Python :: how to lowercase list in python 
Python :: import sklearn linear regression 
Python :: python selenium switch to window 
Python :: how to get the current position of mouse on screen using python 
Python :: thousands separator python 
Python :: clear console python 
Python :: dataframe slice by list of values 
Python :: python loop through directory 
Python :: pandas_datareader 
Python :: check cuda version pytorch 
Python :: sklearn minmaxscaler pandas 
Python :: how to locate image using pyautogui 
Python :: discord.py commands not working 
Python :: python print colored text 
Python :: python - remove scientific notation 
Python :: dataframe select entries that are in a list 
Python :: how to convert a list into a dataframe in python 
Python :: import NoSuchKey in boto3 
Python :: read csv python pandas plot 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =