Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 272 Bytes

get-file-extension.md

File metadata and controls

16 lines (13 loc) · 272 Bytes
title description author tags
Get File Extension
Gets the extension of a file.
axorax
file,extension
import os

def get_file_extension(filepath):
    return os.path.splitext(filepath)[1]

# Usage:
get_file_extension('example.txt') # Returns: '.txt'