splitter di epistole

This commit is contained in:
Alejandro Moreo Fernandez 2018-12-11 14:10:13 +01:00
parent 3eaa58a8de
commit f6f512f18a
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
import os
dir = '../../testi_1'
author = 'Misc'
file=author+'_Epistole.txt'
order = 0
epistola=[]
for line in open(os.path.join(dir,file), 'rt').readlines():
line = line.strip()
if line:
epistola.append(line)
else:
epistola = '\n'.join(epistola)
open(os.path.join(dir,'{}_epistola{}.txt'.format(author,order)), 'wt').write(epistola)
order += 1
epistola = []
if epistola:
epistola = '\n'.join(epistola)
open(os.path.join(dir, '{}_epistola{}.txt'.format(author,order)), 'wt').write(epistola)