file, ext = os.path.splitext(infile) code example
Example 1: python get file extension from path
import os.path
extension = os.path.splitext(filename)[1]
Example 2: os extension
>>> os.path.splitext('/a/b.c/d')
('/a/b.c/d', '')
import os.path
extension = os.path.splitext(filename)[1]
>>> os.path.splitext('/a/b.c/d')
('/a/b.c/d', '')