-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTerminal.py
More file actions
43 lines (29 loc) · 916 Bytes
/
Copy pathTerminal.py
File metadata and controls
43 lines (29 loc) · 916 Bytes
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
# coding:utf8
class Body(object):
def __init__(self):
self.root = 'interface/'
self.main_interface = 'main_interface'
self.blank_tab = ' '
def put_from_file(self, file_name):
with open(self.root + file_name, 'r') as f:
print f.read()
def put_main_interface(self):
self.put_from_file('main_interface')
class Main(object):
def __init__(self):
self.put = Body()
def get_ctrl(self):
while True:
try:
ctrl = int(raw_input('请输入操作:'))
except ValueError:
print '指令非法,请重新输入'
else:
return ctrl
def run_in_main_interface(self):
while True:
self.put.put_main_interface()
ctrl = self.get_ctrl()
if __name__ == '__main__':
test = Main()
test.run_in_main_interface()