Mercurial > repos > fubar > tool_factory_2
comparison test-data/tf2_test_runme.py @ 20:d98f5a09137f draft
Uploaded
author | fubar |
---|---|
date | Mon, 02 Feb 2015 20:57:40 -0500 |
parents | c34063ab3735 |
children |
comparison
equal
deleted
inserted
replaced
19:ff812453b1b3 | 20:d98f5a09137f |
---|---|
1 ### bog standard argparse for 3 possible comma separated lists | |
2 ## followed by some silly reverse each row code provided as an example | |
3 ## you're supposed to replace it with your great code.. | |
4 import sys | |
5 import argparse | |
6 import copy | |
7 argp=argparse.ArgumentParser() | |
8 argp.add_argument('--INNAMES',default=None) | |
9 argp.add_argument('--INPATHS',default=None) | |
10 argp.add_argument('--OUTPATH',default=None) | |
11 argp.add_argument('--additional_parameters',default=[],action="append") | |
12 argp.add_argument('otherargs', nargs=argparse.REMAINDER) | |
13 args = argp.parse_args() | |
14 fout = open(args.OUTPATH,'w') | |
15 sins = open(args.INPATHS.split(',')[0]).readlines() | |
16 for i,sin in enumerate(sins): | |
17 row = sin.strip().split('\t') | |
18 rrow = copy.copy(row) | |
19 lrow = len(row) | |
20 if (lrow > 1): | |
21 for j in range(lrow): | |
22 rrow[j] = row[lrow-j-1] | |
23 fout.write('\t'.join(rrow)) | |
24 fout.write('\n') | |
25 fout.close() |