Created
December 1, 2013 09:55
-
-
Save kosugi/7730661 to your computer and use it in GitHub Desktop.
echo 深夜徘徊 | enspeed.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| from unicodedata import category | |
| PREFIX = u'\u003D\u035E\u035F\u035F\u035E' | |
| def do(istream, ostream): | |
| for c in istream.read(): | |
| if category(c) not in ['Cc', 'Zs']: | |
| ostream.write(PREFIX) | |
| ostream.write(c) | |
| if __name__ == '__main__': | |
| import sys | |
| import codecs | |
| sys.stdin = codecs.getreader('UTF-8')(sys.stdin) | |
| sys.stdout = codecs.getwriter('UTF-8')(sys.stdout) | |
| do(sys.stdin, sys.stdout) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment