How to extract extension from filename in Python?

You can use os.path.splitext() method to extract extension from filename in Python as shown in the below example –

Leave a Reply