how to get an extention of an file python os code example Example: python get file extension from path import os.path extension = os.path.splitext(filename)[1]