-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombine.py
More file actions
40 lines (38 loc) · 1.38 KB
/
combine.py
File metadata and controls
40 lines (38 loc) · 1.38 KB
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
# coding = UTF-8
import os
import sys
import datetime
if __name__ == "__main__":
print('txt 聚合工具 for Paratranz, Copyright 2022 ritenseki.')
print('ritenseki on Github: https://github.com/ritenseki')
# print('本工具免费提供。')
print('开始转换?')
inputting = input('[Y/n]')
if inputting == 'Y':
try:
sourcedirs = os.listdir('.\OriginalFile')
except FileNotFoundError as error:
print('找不到OriginalFile目录,是否新建?')
inp = input('[Y/n]')
if inp == 'Y':
os.makedirs('OriginalFile')
else:
sys.exit()
else:
date = datetime.date.today()
with open(rf".\FileSource\{date}.txt", encoding="UTF-8", mode="w") as final:
for each in sourcedirs:
with open(rf".\OriginalFile\{each}", encoding="UTF-8") as f:
# print(f.readlines())
for fline in f.readlines():
finalline= fline.rstrip("\n")
final.write(finalline)
final.write(" ")
final.write("\n")
print('Done!')
finally:
i = input("按任意键继续")
sys.exit()
else:
i = input("按任意键继续")
sys.exit()