Mercurial > hg > config
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/onelineit.py Thu Oct 15 11:41:26 2009 -0400 @@ -0,0 +1,14 @@ +#!/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())