Python 1

This is my first page on python

# This is to count the number of lines of text files
# in a named folder.
# The following extension qualify a file to be counted:
# tab, txt, csv, py

import os

def file_len(fname):
    with open(fname) as f:
        for i, l in enumerate(f):
    return i + 1

allowed = ['.tab', '.txt', '.csv', '.py']

#    this is where you name the folder you want to search
folderName = 'Z:\\Documents\\Python'

for filename in os.listdir(folderName):    
    filenameOnly, ext = os.path.splitext(filename)
    if ext in allowed: 
        print filename + ' | ' + str(file_len(filename))

# report finished    
# count the number newlines with quotes;