Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pathlib path get filename with extension

>>> from pathlib import Path
>>> p = Path("/home/user/Downloads/repo/test.txt")
>>> print(p.stem)
test
>>> print(p.name)
test.txt
Comment

PREVIOUS NEXT
Code Example
Python :: python check if key exists 
Python :: python check tuple length 
Python :: how to aggregate multiple columns in pyspark 
Python :: how to check current version of library in python 
Python :: calculate percentile pandas dataframe 
Python :: python json normalize 
Python :: python how to calculate how much time code takes 
Python :: python format subprocess output 
Python :: python user input 
Python :: how to generate random numbers in python 
Python :: distance between numpy arrays 
Python :: kivymd window size 
Python :: python get attributes of object 
Python :: check if there are duplicates in list 
Python :: flask get data from html form 
Python :: python recursion save value 
Python :: uninstall python linux 
Python :: make zipfile from directory py 
Python :: python split every character in string 
Python :: fcm_django 
Python :: sorting tuples 
Python :: python show charracter code 
Python :: numpy weighted average 
Python :: use matplotlib in python 
Python :: python list of dictionary unique 
Python :: python mettre en minuscule 
Python :: access django server from another machine 
Python :: cassandra python 
Python :: how to get dictionary input from user in python 
Python :: reset_index(drop=true) 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =