Tuesday, September 28, 2010

ignoring linespace and count line

def countLine():
        fileName='file'
        f=open(fileName)
        count = 0
        for i in f:
                if i.strip() != "":
                        count = count + 1

        f.close()
        return count

No comments:

Post a Comment