Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pathlib get extension

from pathlib import Path
Path("/path/to/file.txt").suffix
Comment

pathlib get extension

import pathlib

print(pathlib.Path('yourPath.example').suffix) # '.example'
print(pathlib.Path("hello/foo.bar.tar.gz").suffixes) # ['.bar', '.tar', '.gz']
Comment

PREVIOUS NEXT
Code Example
Python :: sorting numbers in python without sort function 
Python :: python set intersection 
Python :: how to use one with as statement to open two files python 
Python :: how to practise python 
Python :: Simple way to measure cell execution time in jupyter notebook 
Python :: create age-groups in pandas 
Python :: pandas reset index without adding column 
Python :: python ieee 754 converter 
Python :: remove 1st column pandas 
Python :: search google images python 
Python :: docx change font python 
Python :: dunder pyhton 
Python :: pandas number of columns 
Python :: create an empty dataframe 
Python :: python float to 2 decimals 
Python :: how to get elasticsearch index list using python 
Python :: renaming column in dataframe pandas 
Python :: python decimal string 
Python :: cannot safely cast non-equivalent float64 to int64 
Python :: get one from dataloader 
Python :: Write a Python function to check whether a number is in a given range. 
Python :: change date format python code 
Python :: how to read xlsx file in jupyter notebook 
Python :: sqlite check if table exists 
Python :: how to import axes3d 
Python :: failed to allocate bitmap 
Python :: when was python created 
Python :: date colomn to datetime 
Python :: copy from folder to folder python 
Python :: delete pandas column 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =