-
Notifications
You must be signed in to change notification settings - Fork 0
/
test11
35 lines (29 loc) · 910 Bytes
/
test11
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
if __name__ == "__main__":
file = open("./XinhuaNewsAutoTag.v2.txt", 'r', encoding='UTF-8')
file_handle = open('./XinhuaNewsAutoTag.test.txt', mode='w', encoding='UTF-8')
key = set()
linenumber = 0
while 1:
lines = file.readlines(2000)
if not lines or linenumber > 3000:
break
for line in lines:
#line.split()
file_handle.write(line + '\n')
linenumber+=1
#key.add(line.split('AAA')[0])
pass # do something
#print(key)
if __name__ == "__main__":
file = open("./XinhuaNewsAutoTag.v2.txt", 'r', encoding='UTF-8')
key = set()
linenumber = 0
while 1:
lines = file.readlines(10000)
if not lines:
break
for line in lines:
#line.split()
key.add(line.split('AAA')[0])
pass # do something
print(key)