Python: My own Evernote

  • Posted on December 8, 2015 at 21:31

Search for file with extension (case-insensitive)

#!/usr/bin/python

import re


"""
CASE INDEPENDENT SEARCH FOR EXTENSION (JPG)
"""

filename = "KrusjMe_at_the_dentist.jpg"

prog  = re.compile(r"\.jpe{0,1}g$", re.IGNORECASE)
if prog.search(filename):
    print "Match!"
else:
    print "No match :-("

Leave a Reply