Mercurial > repos > fubar > tool_factory_2
view toolfactory/test-data/runme.py @ 31:69eed330c91f draft
Uploaded
author | fubar |
---|---|
date | Fri, 07 Aug 2020 07:55:35 -0400 |
parents | ad564ab3cf7b |
children |
line wrap: on
line source
# reverse order of columns in a tabular file import argparse parser = argparse.ArgumentParser() a = parser.add_argument a('--infile',default='') a('--outfile',default=None) a('--prefix',default=None) args = parser.parse_args() inp = args.infile outp = args.outfile i = open(inp,'r').readlines() o = open(outp,'w') for row in i: rs = row.rstrip() rs = list(rs) rs.reverse() o.write('%s:%s' % (args.prefix,''.join(rs))) o.write('\n') o.close()