Project

General

Profile

« Previous | Next » 

Revision 3817

cols: Removed special handling of '+' because list_subset() now handles this col_num value itself, by appending the rest of the columns. Support intermixing int and '+' columns, by using new format.str2int_passthru().

View differences:

bin/cols
7 7

  
8 8
sys.path.append(os.path.dirname(__file__)+"/../lib")
9 9

  
10
import format
10 11
import util
11 12

  
12 13
def main():
13 14
    col_nums = sys.argv[1:]
14 15
    if col_nums == []:
15 16
        raise SystemExit('Usage: '+sys.argv[0]+' col_num... <map >columns_map')
16
    if col_nums[0] == '+': col_nums = None # list_subset() value for all columns
17
    else: col_nums = map(int, col_nums) # 0-based
17
    col_nums = map(format.str2int_passthru, col_nums) # 0-based
18 18
    
19 19
    # Process map
20 20
    reader = csv.reader(sys.stdin)

Also available in: Unified diff