-
Notifications
You must be signed in to change notification settings - Fork 0
/
combine.py
67 lines (61 loc) · 1.73 KB
/
combine.py
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
from module import Converter, Data, File
def first_step():
data = Data()
local_data = data.get_local()
remote_coverted_data = Converter(data.get_remote()).convert_to_local_style()
namelist = []
for i in local_data:
namelist.append(i[0])
different_list = []
for i in remote_coverted_data:
if i[0] in namelist:
pass
else:
different_list.append(i)
File(different_list).write_to_local()
def second_step():
data = Data()
local_converted_data = Converter(data.get_local()).convert_to_remote_style()
remote_data = data.get_remote()
namelist = []
for i in remote_data:
namelist.append(i[0])
different_list = []
for i in local_converted_data:
if i[0] in namelist:
pass
else:
different_list.append(i)
File(different_list).write_to_remote()
def third_step():
data = Data()
local_data = data.get_local()
cancel_list = []
for i in local_data:
if i[-4] == "退餐":
cancel_list.append(i)
else:
pass
File(cancel_list).write_cancel()
def forth_step():
data = Data()
local_data = data.get_local()
remote_data = data.get_remote()
notelist = []
for i in remote_data:
try:
name = i[0]
namelist = [i[0] for i in local_data]
local_index = namelist.index(name)
local_note = local_data[local_index][4]
remote_note = i[4]
notelist.append(local_note + remote_note)
except:
notelist.append(i[4])
print(len(notelist))
File(notelist).write_remote_note()
if __name__ == '__main__':
first_step()
second_step()
third_step()
forth_step()