Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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 :: python ceiling 
Python :: float number field django models 
Python :: how to know python bit version 
Python :: how to code a clickable button in python 
Python :: stop server django programmatically 
Python :: zeller year 
Python :: how to do label encoding in multiple column at once 
Python :: how to add time with time delta in python 
Python :: load diamonds dataset from sns 
Python :: sns lineplot title 
Python :: remove minimize and maximize and cancle button python pyqt5 
Python :: python merge strings in columns 
Python :: pygame font 
Python :: input stdout python 
Python :: python matplotlib inline 
Python :: random numbers in python 
Python :: procfile flask 
Python :: python drop rows with two conditions 
Python :: how to add an active class to current element in navbar in django 
Python :: python parser txt to excel 
Python :: getting dummies for a column in pandas dataframe 
Python :: how to remove the very last character of a text file in python 
Python :: python gt index in for cycle 
Python :: python how often character ins tring 
Python :: colorized progress bar python in console 
Python :: choose random index from list python 
Python :: Python Time object to represent time 
Python :: to_csv drop index 
Python :: get most repeated instance in a queryset django 
Python :: df reanme columns 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =