| 123456789101112131415161718192021222324252627282930313233 |
- #!/usr/bin/env python
- # coding=utf-8
- import argparse
- def format_model(input_file, output_file):
- out_fp = open(output_file, 'w')
- with open(input_file) as in_fp:
- index = 0
- for line in in_fp:
- index += 1
- line = line.strip()
- cells = line.split(' ')
- if index == 1:
- cells = cells[:2]
- else:
- cells = cells[:10]
- new_line = '%s\n' % '\t'.join(cells)
- out_fp.write(new_line)
- out_fp.close()
- if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument('--input', required=True, type=str, help='input file')
- parser.add_argument('--output', required=True, type=str, help='output file')
- args = parser.parse_args()
- print('\n\n')
- print(args)
- print('\n\n')
- format_model(args.input, args.output)
|