Package pysys :: Package utils :: Module linecount
[hide private]
[frames] | no frames]

Module linecount

source code

Functions [hide private]
integer
linecount(file, regexpr=None, ignores=None)
Count the number of lines in an input file matching a regular expression, return the count.
source code
Variables [hide private]
  __package__ = 'pysys.utils'
Function Details [hide private]

linecount(file, regexpr=None, ignores=None)

source code 

Count the number of lines in an input file matching a regular expression, return the count.

If the input regular expression is set to None, the method returns a count of the number of lines in the input file. The regular expression should be passed in as a string, i.e. "[a-z]_foo.*" etc.

Parameters:
  • file - The full path to the input file
  • regexpr - The regular expression used for counting matches
  • ignores - A list of regular expressions that will cause lines to be excluded from the count
Returns: integer
The number of matching lines in the input file
Raises: