Mercurial > hg > TextShaper
view textshaper/onelineit.py @ 41:56199789d2a0
mv
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 25 Aug 2014 19:22:37 -0700 |
parents | onelineit.py@e1832eeae084 |
children | 1a80204bd562 |
line wrap: on
line source
#!/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())