Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python get file extension from path

import os.path
extension = os.path.splitext(filename)[1]
Comment

get file extension python

import pathlib

print(pathlib.Path('yourPath.example').suffix) # '.example'
#or 
import os
filename, file_extension = os.path.splitext('/path/to/somefile.ext')
Comment

PREVIOUS NEXT
Code Example
Python :: RandomForestRegressor import 
Python :: python print error traceback 
Python :: get object attributes python 
Python :: python save list to text 
Python :: return the count of a given substring from a string python 
Python :: Sin , Cos Graph using python turtle. 
Python :: change py version in colab 
Python :: how to fill na python 
Python :: how to split a list to 1000 items python 
Python :: get all columns names starting with pandas 
Python :: python sorted descending 
Python :: how to display qr code in python 
Python :: crear matriz python for 
Python :: reading a csv file in python 
Python :: python mouse click 
Python :: python read xml 
Python :: Removing punctuation with NLTK in Python 
Python :: python pandas csv to xlsx semicolon 
Python :: Need Clang = 7 to compile Filament from source 
Python :: Simulate webcam and microphone selenium 
Python :: How do you create and update One2Many and Many2Many records with Python 3? 
Python :: how to tell python to create a random numer 
Python :: start jupyter notebook with python 3.7 
Python :: python parse dict from string 
Python :: python nextcord bot slash command 
Python :: `12` print () 
Python :: find links in web page web scraping 
Python :: how to ascess GPS in python 
Python :: create numpy table with random values in range 
Python :: how to include specific data type from the dataframe 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =