-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
28 lines (26 loc) · 960 Bytes
/
Main.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
import sys
from util.HtmlParser import *
from util.Distinct import *
from Constants import *
import jsonpickle
from util.TxtParser import *
if __name__ == '__main__':
# htmlParser = HtmlParser()
# movieList = htmlParser.getMovieList()
# dis = Distinct(movieList)
# distinctMovieList = dis.distinct()
# with open(EXPORT_PATH, 'a') as f:
# # f.write(json.dumps(distinctMovieList, sort_keys=True, indent=4, separators=(', ', ': ')))
# str = jsonpickle.encode(distinctMovieList, unpicklable=False)
# # print(str)
# f.write(str)
txtParser = TxtParser()
movieList = txtParser.getMovieList()
dis = Distinct(movieList)
distinctMovieList = dis.distinct()
with open(EXPORT_PATH, 'a') as f:
s = jsonpickle.encode(distinctMovieList, unpicklable=False)
# print(str)
f.write(s)
print('去重前:' + str(len(movieList)))
print('去重后' + str(len(distinctMovieList)))