

def _write_begin(f, flds, lineterminator, caption, index_header, truncate):
    f.write(("<table class='petl'>" + lineterminator))
    if (caption is not None):
        f.write((('<caption>%s</caption>' % caption) + lineterminator))
    f.write(('<thead>' + lineterminator))
    f.write(('<tr>' + lineterminator))
    for (i, h) in enumerate(flds):
        if index_header:
            h = ('%s|%s' % (i, h))
        if truncate:
            h = h[:truncate]
        f.write((('<th>%s</th>' % h) + lineterminator))
    f.write(('</tr>' + lineterminator))
    f.write(('</thead>' + lineterminator))
    f.write(('<tbody>' + lineterminator))

dataset/ETHPy150Open alimanfoo/petl/petl/io/html.py _write_begin/original