Project

General

Profile

« Previous | Next » 

Revision 4978

ins_col: Added column fill value param

View differences:

ins_col
5 5
import sys
6 6

  
7 7
def main():
8
    try: _prog_name, col_num, name = sys.argv
8
    try: _prog_name, col_num, name, fill_value = sys.argv
9 9
    except ValueError: raise SystemExit('Usage: '+sys.argv[0]
10
        +' <in col# col_name [| '+sys.argv[0]+' col_2# col_2_name]... >out')
10
        +' <in col# col_name fill_value [| '+sys.argv[0]
11
        +' col_2# col_2_name col_2_value]... >out')
11 12
    col_num = int(col_num)
12 13
    
13 14
    # Transform input
......
19 20
        row.insert(col_num, value)
20 21
        if is_header:
21 22
            is_header = False
22
            value = ''
23
            value = fill_value
23 24
        writer.writerow(row)
24 25

  
25 26
main()

Also available in: Unified diff