comparison 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
comparison
equal deleted inserted replaced
40:e1832eeae084 41:56199789d2a0
1 #!/usr/bin/env python
2
3 def onelineit(string):
4 string = string.split('\n')
5 string = [ i.strip() or '\n' for i in string ]
6 string = ' '.join(string)
7 string = string.split('\n')
8 string = [ i.strip() for i in string if i.strip() ]
9
10 return '\n\n'.join(string)
11
12 if __name__ == '__main__':
13 import sys
14 print onelineit(sys.stdin.read())