Advertisement
Guest User

translate.py

a guest
Aug 19th, 2013
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import sys
  3. from optparse import OptionParser
  4. def translate(sentence):
  5.     sent_l = list(sentence)
  6.     for c in sent_l:
  7.         if 224 <= ord(c) <= 250:
  8.             sys.stdout.write(unichr(ord(u'א')+ord(c)-ord(u'à')).encode('utf-8'))
  9.         else:
  10.             sys.stdout.write(c.encode('utf-8'))
  11.     print
  12. sentence="à áï éäåãä"
  13. translate(sentence.decode('utf-8'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement