strip extension from filename python code example
Example 1: python get file extension from path
import os.path
extension = os.path.splitext(filename)[1]
Example 2: strip file extension python
import os
print(os.path.splitext("/path/to/some/file.txt")[0])
Example 3: os extension
>>> os.path.splitext('/a/b.c/d')
('/a/b.c/d', '')