-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtranslation_table.py
More file actions
87 lines (80 loc) · 1.7 KB
/
translation_table.py
File metadata and controls
87 lines (80 loc) · 1.7 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
LTRS = {
"11000" : "A",
"10011" : "B",
"01110" : "C",
"10010" : "D",
"10000" : "E",
"10110" : "F",
"01011" : "G",
"00101" : "H",
"01100" : "I",
"11010" : "J",
"11110" : "K",
"01001" : "L",
"00111" : "M",
"00110" : "N",
"00011" : "O",
"01101" : "P",
"11101" : "Q",
"01010" : "R",
"10100" : "S",
"00001" : "T",
"11100" : "U",
"01111" : "V",
"11001" : "W",
"10111" : "X",
"10101" : "Y",
"10001" : "Z",
"00000" : "[Blank]",
"00100" : " ", # [SPACE]
"00010" : "", # [CR]
"01000" : "", # [LF]
"11011" : "", # [Figures]
"11111" : "", # [Letters]
}
FIGS = {
"11000" : "-",
"10011" : "?",
"01110" : ":",
"10010" : "$",
"10000" : "3",
"10110" : "!",
"01011" : "&",
"00101" : "#",
"01100" : "8",
"11010" : "'",
"11110" : "(",
"01001" : ")",
"00111" : ".",
"00110" : ",",
"00011" : "9",
"01101" : "0",
"11101" : "1",
"01010" : "4",
"10100" : "[Bell]",
"00001" : "5",
"11100" : "7",
"01111" : ";",
"11001" : "2",
"10111" : "/",
"10101" : "6",
"10001" : "\"",
"00000" : "[Blank]",
"00100" : " ", # [SPACE]
"00010" : "", # [CR]
"01000" : "", # [LF]
"11011" : "", # [Figures]
"11111" : "", # [Letters]
}
def table(sequence, mode):
if mode == "11111" :
print(LTRS[sequence], end="")
else :
print(FIGS[sequence], end="")
# [Letters] or [SPACE]の後はLTRSになる
if sequence == "11111" or sequence == "00100" :
mode = "11111"
# [LTRS]の後はFIGSになる
elif sequence == "11011" :
mode = "11011"
return mode