Skip to main content

Parse input streams with headers and footers.

Project description

Overview

header-detail-footer provides a way to read input streams (usually text files) that contain header rows, a number of data rows, and footer rows. The number of header and footer rows must be specified when parsing begins. There can be zero or more header rows, and zero or more footer rows. The detail rows are all of the rows between the header and footer. If a file consists of just headers and footers, there will be zero detail rows.

Typical usage

This code shows a simple usage of the ‘parse()’ function:

from header_detail_footer import parse

header, details, footer = parse(iter(['header', 'row 1', 'row 2', 'footer']))
assert header() == 'header'
assert list(details()) == ['row 1', 'row 2']
assert footer() == 'footer'

Exceptions

HeaderError

FooterError

Change log

0.1 2013-11-14 Eric V. Smith

  • Initial release.

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page