comparison python/onelineit.py @ 0:f3ab51c79813

adding configuration from https://svn.openplans.org/svn/config_jhammel/
author k0s <k0scist@gmail.com>
date Thu, 15 Oct 2009 11:41:26 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f3ab51c79813
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())