代码拉取完成,页面将自动刷新
import os
path = os.getcwd()+"\\サクラメントの十二宫 乱れる仔ひつじと手懐く狼\\"
dirs = os.listdir(path+"ExtractInnerQuota\\")
pernum = 179 #行数/字数比向上取整
count = 0
for dir in dirs:
print(dir)
f1 = open(path+"ExtractInnerQuota\\"+dir,"r",encoding='utf-8')
text_lines = f1.readlines()
num = len(text_lines)//pernum
print(num)
count = 0
while count < num:
#for text in text_lines[count*pernum:(count+1)*pernum-1]:
n = count*pernum
list = []
while n < (count+1)*pernum:
if text_lines[n] == "\n":
n += 1
else:
list.append(text_lines[n].strip("\n"))
n += 1
with open(path+"Slice\\"+dir.strip(".txt")+"0"+str(count)+".txt","w",encoding="utf-8") as f2:
for ScriptText in list:
f2.write(ScriptText+"\n")
f2.close()
with open(path+"Translated\\"+dir.strip(".txt")+"0"+str(count)+"(tled).txt","w",encoding="utf-8") as f3:
f3.close()
count += 1
n = count*pernum
list = []
while n < len(text_lines):
if text_lines[n] == "\n":
print("空行")
n += 1
else:
list.append(text_lines[n].strip("\n"))
n += 1
with open(path+"Slice\\"+dir.strip(".txt")+"0"+str(count)+".txt","w",encoding="utf-8") as f2:
for ScriptText in list:
f2.write(ScriptText+"\n")
f2.close()
with open(path+"Translated\\"+dir.strip(".txt")+"0"+str(count)+"(tled).txt","w",encoding="utf-8") as f3:
f3.close()
f1.close()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。