comparison toolfactory/test-data/runme.py @ 30:6f48315c32c1 draft

Uploaded
author fubar
date Fri, 07 Aug 2020 07:54:23 -0400
parents ad564ab3cf7b
children
comparison
equal deleted inserted replaced
29:6db39cbc3242 30:6f48315c32c1
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()