Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*- coding: utf-8 -*-
- import sys
- class SwitchKey:
- def __init__(self):
- self.codes = {
- 'Q':u'й',
- 'W':u'ц',
- 'E':u'у',
- 'R':u'к',
- 'T':u'е',
- 'Y':u'н',
- 'U':u'г',
- 'I':u'ш',
- 'O':u'щ',
- 'P':u'з',
- '{':u'х',
- '}':u'ъ',
- 'A':u'ф',
- 'S':u'ы',
- 'D':u'в',
- 'F':u'а',
- 'G':u'п',
- 'H':u'р',
- 'J':u'о',
- 'K':u'л',
- 'L':u'д',
- ';':u'ж',
- "'":u'э',
- 'Z':u'я',
- 'X':u'ч',
- 'C':u'с',
- 'V':u'м',
- 'B':u'и',
- 'N':u'т',
- 'M':u'ь',
- ',':u'б',
- '.':u'ю',
- '`':u'ё',
- }
- self.__update__()
- def __inverse__(self):
- key = self.codes.keys()
- value = self.codes.values()
- def lower(s):
- return s.lower()
- def upper(s):
- return s.upper()
- nkey = map(upper,value)
- nval = map(lower,key)
- return dict(zip(nkey,nval))
- def __update__(self):
- dict = self.__inverse__()
- self.codes.update(dict)
- def switch(self,string):
- key = self.codes.keys()
- s = ''
- for i in string.upper():
- if i in key:
- s += self.codes[i]
- else:
- s += i
- return s
- x = SwitchKey()
- print x.switch(sys.argv[1].decode('utf'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement