Mercurial > repos > fubar > tool_factory_2
annotate toolfactory/test-data/runme.py @ 31:69eed330c91f draft
Uploaded
author | fubar |
---|---|
date | Fri, 07 Aug 2020 07:55:35 -0400 |
parents | ad564ab3cf7b |
children |
rev | line source |
---|---|
28 | 1 # reverse order of columns in a tabular file |
2 import argparse | |
3 parser = argparse.ArgumentParser() | |
4 a = parser.add_argument | |
5 a('--infile',default='') | |
6 a('--outfile',default=None) | |
7 a('--prefix',default=None) | |
8 args = parser.parse_args() | |
9 inp = args.infile | |
10 outp = args.outfile | |
11 i = open(inp,'r').readlines() | |
12 o = open(outp,'w') | |
13 for row in i: | |
14 rs = row.rstrip() | |
15 rs = list(rs) | |
16 rs.reverse() | |
17 o.write('%s:%s' % (args.prefix,''.join(rs))) | |
18 o.write('\n') | |
19 o.close() |