# HG changeset patch # User Jeff Hammel # Date 1409716915 25200 # Node ID 6327c66e5f4664f52e88406df5d5b77e997d3d13 # Parent 8466deea2eaf696e01f432a88fa607b807a26fa9 moved to http://k0s.org/hg/TextShaper diff -r 8466deea2eaf -r 6327c66e5f46 python/onelineit.py --- a/python/onelineit.py Tue Sep 02 13:16:38 2014 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#!/usr/bin/env python - -def onelineit(string): - string = string.split('\n') - string = [ i.strip() or '\n' for i in string ] - string = ' '.join(string) - string = string.split('\n') - string = [ i.strip() for i in string if i.strip() ] - - return '\n\n'.join(string) - -if __name__ == '__main__': - import sys - print onelineit(sys.stdin.read())