Pages for logged out editors learn more
import os foo = "SUNSET.JPG" (base, ext) = os.path.splitext(foo) ext = ext[1:] # strip first char (.) if ext.lower() in ["jpg", "jpeg", "png", "gif"]: print "image!"