On Sun, Aug 02, 2015 at 11:46:31PM +0100, Alan Gauld wrote: > On 02/08/15 23:01, Alan Gauld wrote: > > >found = False > >for s in (".jpg",".png",".avi",".mp4"): > > found = test or (s in file.lower()) > > Oops, that should be: > > found = found or (s in file.lower())
extensions = (".jpg",".png",".avi",".mp4") found = any(s in filename.lower() for s in extensions) but that's still wrong, because it will find files like History.of.Avis.PA.pdf as if it were an AVI file. Instead, use os.path.splitext. -- Steve _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor