Example on how to parse/search for file in a directory

import os
import re

PATH = '.'       # Current Directory
PATTERN = '.bak' # Check for if filename contains this pattern

def print_matched_files(path=PATH,pattern=PATTERN):
    ''' 
    prints files in a location
    '''
    count = 1
    print '[=================][Input]'
    print 'File Location',path
    print 'Search pattern provided',pattern
    print '[=================][Printing files ....]'
    files = [f for f in os.listdir(PATH) if re.match(PATTERN, f)]
    for each in files:
        print count,'Filename Name',each
        count = count + 1
    print '[=================][Printing files completed]'