Project

General

Profile

« Previous | Next » 

Revision 14593

lib/csvs.py: RowNumFilter: added support for filtering the header row as well

View differences:

trunk/lib/csvs.py
225 225

  
226 226
class RowNumFilter(ColInsertFilter):
227 227
    '''Adds a row # column at the beginning of each row'''
228
    def __init__(self, reader):
228
    def __init__(self, reader, col_name=None):
229 229
        def mk_value(row, row_num): return row_num
230
        ColInsertFilter.__init__(self, reader, mk_value, 0)
230
        ColInsertFilter.__init__(self, reader, mk_value, col_names=col_name)
231 231

  
232 232
class InputRewriter(StreamFilter): # is also a stream
233 233
    '''Wraps a reader, writing each row back to CSV'''

Also available in: Unified diff