Skip to content

Instantly share code, notes, and snippets.

@ikarth
Created November 3, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikarth/02a8cb4b95568d4362ca to your computer and use it in GitHub Desktop.
Save ikarth/02a8cb4b95568d4362ca to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# You may need to set the environment variable to output utf-8.
# On Windows, the command is: set PYTHONIOENCODING=utf-8
# Or, more sensibly, you could rewrite this to write directly
# to a file rather than stdout
import sys
for line in open(sys.argv[1], mode='r', encoding="utf-8"):
if line.strip()=='':
print('\n')
else:
if line.isupper():
print(line, sep='', end='')
else:
if line[:1]=="*":
print(line, sep='', end='')
else:
print((line.rstrip()), end=' ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment