Is there a function to extract the extension from a filename?
A true one-liner, if you like regex. And it doesn't matter even if you have additional "." in the middle
import re file_ext = re.search(r"\.([^.]+)$", filename).group(1)
See here for the result: Click Here