-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2021_2_24_test_en.py
54 lines (51 loc) · 1.68 KB
/
2021_2_24_test_en.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
# a = "Bioengineered Bugs Call for Papers;"
# print(a.split(";;"))
import os
file_ch_dir = "D:/monetwaredata/ch"
file_en_dir = "D:/monetwaredata/en"
ms = open('D:/monetwaredata/en.txt', 'a', encoding='utf-8')
files = os.listdir(file_en_dir)
print(files)
files_dir = []
for file in files:
files_dir.append(file_en_dir + '/' + file)
print(file_en_dir + '/' + file)
# file_name = files_dir[0]
# file = open(file_name, 'r', encoding='utf-8')
# line = file.readline()
# while line:
# line = file.readline()
number = 0
for file_dir in files_dir:
file = open(file_dir, 'r', encoding='utf-8')
line = file.readline()
while line:
number = number + 1
print(number)
print(line)
if line == '\n':
line = file.readline()
else:
if ':' in line:
words = line.split(':')
if words[0] != "Fund-基金" and words[0] != "Year-年":
ms.write(line)
line = file.readline()
if words[0] == "Fund-基金":
ms.write(line.replace('\n', ''))
line = file.readline()
if words[0] == "Year-年":
ms.write('\n')
ms.write(line)
line = file.readline()
else:
ms.write(line.replace('\n', ''))
line = file.readline()
ms.close()
# for i in range(len(topic_6_bility)):
# if topic_6_bility[i][0] > 0.5:
# title_file_name = r"D:/topic_6/" + str(1) + ".txt"
# ms = open(title_file_name, 'a', encoding='utf-8')
# ms.write(topic_6_list[i])
# ms.write('\n')
# title_1.append(topic_6_list[i])