aggiunto convertitore di docx
This commit is contained in:
21
bananaSPLIT/convert.py
Normal file
21
bananaSPLIT/convert.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
'''
|
||||||
|
Created on 30 mar 2020
|
||||||
|
|
||||||
|
@author: Emanuele Trabattoni
|
||||||
|
'''
|
||||||
|
import glob, docx2txt
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
fList = glob.iglob("../TestFiles/File nuovo formato/*.docx")
|
||||||
|
for f in fList:
|
||||||
|
#os.remove(f.replace('.docx', '.txt'))
|
||||||
|
print(f)
|
||||||
|
try:
|
||||||
|
txt=docx2txt.process(f)
|
||||||
|
with open(f.replace('.docx', '.txt'), 'w') as fp:
|
||||||
|
fp.write(txt.replace('\r\n','\n'))
|
||||||
|
fp.close()
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
pass
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user