Skip to content

Instantly share code, notes, and snippets.

@tef
Created January 13, 2013 20:36
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 tef/4526103 to your computer and use it in GitHub Desktop.
Save tef/4526103 to your computer and use it in GitHub Desktop.
# coding=utf-8
import sys
normal = u' 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~'
wide = u' 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!゛#$%&()*+、ー。/:;〈=〉?@[\\]^_‘{|}~'
widemap = dict((ord(n), w) for n,w in zip(normal, wide))
while True:
line = sys.stdin.readline()
if not line:
break
line = line.decode('utf-8').translate(widemap)
sys.stdout.write(line.encode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment