Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get path to file without filename python

import os
filepath = '/a/path/to/my/file.txt'
os.path.dirname(filepath)
# Yields '/a/path/to/my'
Comment

PREVIOUS NEXT
Code Example
Python :: shapely polygon from string 
Python :: object to int64 pandas 
Python :: python hashlib.sha512() 
Python :: python reload class 
Python :: how to right click in pyautogui 
Python :: convert column to datetime format python 
Python :: export file csv 
Python :: pyspark date to week number 
Python :: python remove last character from string 
Python :: mac install python 3.8 
Python :: python random hex color 
Python :: python alert 
Python :: how to delete last N columns of dataframe 
Python :: Presskeys in python 
Python :: python except error as e 
Python :: python read file line by line 
Python :: python 3 pm2 
Python :: shuffle dataframe python 
Python :: how to import login required in django 
Python :: pygame draw circle 
Python :: export pandas dataframe as excel 
Python :: python - convert a column in a dataframe into a list 
Python :: python change working directory to file directory 
Python :: pandas groupby column count distinct values 
Python :: from string to time python dataframe 
Python :: Python - How to check if string is a HEX Color Code 
Python :: python messagebox 
Python :: anaconda-navigator command not found 
Python :: seaborn rotate xlabels 
Python :: keras import optimizer adam 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =