Alex Rivera | Logout

Extracting extension from filename

Asked 2009-02-12T14:11:50.570
1879

Is there a function to extract the extension from a filename?

Edit
Report

1 Answer

44

worth adding a lower in there so you don't find yourself wondering why the JPG's aren't showing up in your list.

os.path.splitext(filename)[1][1:].strip().lower()
answered 2012-12-28T07:25:49.757

Your Answer