Next / Previous / Contents / Shipman's homepage

88.3. headerReport(): General information

This function displays the general file information from a DbfHeader object; see Section 90.2, “DbfHeader: Database header object”.

dbfstruct
# - - -   h e a d e r R e p o r t   - - -

def headerReport(fileName, header):
    '''Report general file information.

      [ (fileName is the file name) and
        (header is a dbf.DbfHeader object) ->
          sys.stdout  +:=  report on fileName and header ]
    '''

This report has a two-column format, with the label in the first column and the value in the second. The same format is used for each line.

dbfstruct
    format = "%-20s %s"
    print format % ("File name", fileName)
    print format % ("Last update", header.lastUpdate)
    print format % ("Number of records", header.recordCount)
    print format % ("Record length", header.recordLength)
    print format % ("Number of fields", len(header.fields))