ThibH
7/2/2015 - 7:11 PM

Separate filename and extension

Separate filename and extension

fileName, fileExtension = os.path.splitext('/path/to/somefile.ext')

>>> fileName
'/path/to/somefile'
>>> fileExtension
'.ext'