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 :: matplotlib remove ticks and lines 
Python :: install python3 centos 7.8 
Python :: discord.py presence 
Python :: how to find wifi password using python 
Python :: django filter not equal to 
Python :: check pip for conflicts 
Python :: intersection of two lists python 
Python :: python read url 
Python :: auth proxy python 
Python :: python beautifulsoup write to file 
Python :: OSError: cannot write mode RGBA as JPEG Python 
Python :: update anaconda 
Python :: python set env var 
Python :: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. 
Python :: les librairies python a maitriser pour faire du machine learning 
Python :: how to send get request python 
Python :: get active window title python 
Python :: mongodb python get all documents 
Python :: split string in the middle python 
Python :: python setup.py bdist_wheel did not run successfully 
Python :: how to loop the length of an array pytoh 
Python :: how to multiply inputs in python 
Python :: python clipboard to image 
Python :: Python tkinter window fullscreen with title bar 
Python :: python3 as default python path macos 
Python :: cv2 image object to base64 string 
Python :: how to convert column to index in pandas 
Python :: python turtle sierpinski triangle 
Python :: Tensorflow not installing error 
Python :: last element in dictionary python 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =