def letter_num let alph абвгдежзиіклмнопрсту фхцчшщъыьѣэюяѳѵu B_alph А

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def letter_num(let):
alph = u'абвгдежзиіклмнопрстуфхцчшщъыьѣэюяѳѵu'
B_alph = u'АБВГДЕЖЗИІКЛМНОПРСТУФХЦЧШЩЪЫЬѢЭЮЯѲѴ'
for i in range(0,len(alph)):
if alph[i] == let:
return i
for i in range(0,len(B_alph)):
if B_alph[i] == let:
return i
class Old:
def __init__(self, st = ''):
self.string = st
def Print(self):
print self.string
def __eq__(self, other):
if self.string == other.string:
return True
else:
return False
def __lt__(self, other):
if self.string in other.string:
return True
elif other.string in self.string:
return False
for l in range(0, len(self.string)):
if self.string[l] == other.string[l]:
continue
if letter_num(self.string[l]) < letter_num(other.string[l]):
return True
else:
return False
def __gt__(self, other):
if self.string in other.string:
return False
elif other.string in self.string:
return True
for l in range(0, len(self.string)):
if self.string[l] == other.string[l]:
continue
if letter_num(self.string[l]) > letter_num(other.string[l]):
return True
else:
return False
s1 = Old(u'бѣлый')
s0 = Old(u'бѣл')
s2 = Old(u'бэбебе')
s3 = Old(u'Ѳядоръ')
s4 = Old(u'Ѳідоръ')
s5 = Old(u'Ѵссопъ')
s6 = Old(u'Ѵрсопъ')
array = [s1, s2, s3, s4, s0, s5, s6]
for i in sorted(array):
print i.string
if s0 < s1:
print " бѣл < бѣлый True"
if s0 > s1:
print " бѣл < бѣлый True"
if s1 > s0:
print " бѣл > бѣлый True"