-
Notifications
You must be signed in to change notification settings - Fork 0
/
bib2GBT_2.py
38 lines (29 loc) · 1.06 KB
/
bib2GBT_2.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
import bib2GBT
import sys
import os
if __name__ == "__main__":
bibFileDic = sys.argv[1]
save2file = sys.argv[2]
lines = []
files = []
for filepath,dirnames,filenames in os.walk(bibFileDic):
for filename in filenames:
file_path = os.path.join(filepath,filename)
files.append("\n原始文件名:" + file_path + '\n')
_count = 1
for l in bib2GBT.mainProscess(file_path):
lines.append(l)
files.append(f'[{_count}] ' + l + '\n')
_count += 1
# lines.append(bib2GBT.mainProscess(file_path))
# files.append("原始文件名:" + file_path + '\n')
# files.append(bib2GBT.mainProscess(file_path) + '\r\n')
if save2file == "true":
with open("output_GBT7714.txt", "w", encoding='utf-8') as f:
for l in files:
f.write(l)
else:
count = 1
for l in lines:
print(f'[{count}]', l)
count += 1