Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python how to get directory of script

import os
print(os.path.abspath(''))
Comment

python get directory of current script file

import os
os.path.abspath(__file__) # Directory of current python script
#Output will look something like: C:UsersUserNameDesktoppy-script.py
Comment

PREVIOUS NEXT
Code Example
Python :: getting the file path of a file object in python 
Python :: small factorial codechef solution 
Python :: basemap python 
Python :: django check if queryset is empty 
Python :: create 2d array python list comprehension 
Python :: numpy matrix 
Python :: python make directory tree from path 
Python :: python yaml to dict 
Python :: django on_delete options 
Python :: python ftp login 
Python :: python check if nan 
Python :: pygame music player 
Python :: pd count how many item occurs in another column 
Python :: python get list of files in directory 
Python :: pandas multiindex to single index 
Python :: pandas replace colomns location 
Python :: jupyter notebook delete the output 
Python :: drop column with nan values 
Python :: dictionary to a dataframe pandas arrays must all be same length 
Python :: pandas test for nan 
Python :: python unicode is not defined 
Python :: update set python 
Python :: normal distribution in python 
Python :: nlargest heapq 
Python :: print subscript and superscript python 
Python :: roots of quadratic equation in python 
Python :: Make a Basic Face Detection Algorithm in Python Using OpenCV and Haar Cascades 
Python :: python open file relative to script location 
Python :: replace df with 
Python :: failed to allocate bitmap 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =