Mercurial > hg > TextShaper
changeset 16:4e00a2ce0a06
move
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sat, 22 Feb 2014 16:56:41 -0800 |
parents | 497b29bba41b |
children | 30c534d3db66 |
files | split.py textshaper/split.py |
diffstat | 2 files changed, 31 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/split.py Fri Feb 14 14:07:38 2014 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" -split some lines -""" - -import argparse -import os -import sys - -def main(args=sys.argv[1:]): - - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument('input', nargs='?', - type=argparse.FileType('r'), default=sys.stdin, - help='input file, or read from stdin if ommitted') - parser.add_argument('--quote', dest='quote', - action='store_true', default=False) - options = parser.parse_args(args) - - read = options.input.read() - - lines = read.strip().split() - if options.quote: - lines = ["'{}'".format(line) for line in lines] - - print '\n'.join(lines) - -if __name__ == '__main__': - main()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/textshaper/split.py Sat Feb 22 16:56:41 2014 -0800 @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +split some lines +""" + +import argparse +import os +import sys + +def main(args=sys.argv[1:]): + + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('input', nargs='?', + type=argparse.FileType('r'), default=sys.stdin, + help='input file, or read from stdin if ommitted') + parser.add_argument('--quote', dest='quote', + action='store_true', default=False) + options = parser.parse_args(args) + + read = options.input.read() + + lines = read.strip().split() + if options.quote: + lines = ["'{}'".format(line) for line in lines] + + print '\n'.join(lines) + +if __name__ == '__main__': + main()