RECURRENT DONATION
Donate monthly to support
the NeculaiFantanaru.com project
Ny toetra tena ilaina amin'ity boky ity raha ampitahaina amin'ny hafa eny an-tsena amin'ny sehatra iray ihany dia ny famariparitana amin'ny alalan'ny ohatra ny fahaiza-manaon'ny mpitarika iray. Tsy nilaza mihitsy aho hoe mora ny ho tonga mpitarika tsara, fa raha tian'ny olona...
Nanoratra ity boky ity aho izay mampifandray amin'ny fomba tsotra ny fivoaran'ny tena manokana amin'ny fitarihana, toy ny piozila, izay tsy maintsy ampifandraisinao ny ampahany rehetra mba hamerenana ny sary ankapobeny.
Ny tanjon'ity boky ity dia ny hanome anao vaovao amin'ny alalan'ny ohatra mivaingana ary hampiseho aminao ny fomba hahazoanao ny fahaiza-manao hahatonga ny hafa hahita zavatra mitovy amin'ny anao.
Raha tsy mihevitra azy io ho fifanarahana, ny boky dia maneho ny andrana ny olon-tsotra iray - ny mpanoratra - izay amin'ny alalan'ny teny tsotra, zava-misy sy ny ohatra mahazatra mampianatra ny olon-tsotra herim-po sy ny fanantenana amin'ny fikatsahany manokana ho tompony sy izay mahalala. .. mety ho mpitarika mihitsy aza.
Azonao atao ny mijery ny kaody feno:Https: // passatin.com / 4yl0ir ep hametrakaPython. #------------------------------------------------------------------------------- # Name: Convert Doc and DocX to PDF # Purpose: # # Author: Fantanaru Neculai # # Created: 18/03/2022 # Copyright: (c) Fantanaru Neculai 2022 #------------------------------------------------------------------------------- # pip install pywin32 # pip install docx2txt import docx2txt from win32com import client import os files_from_folder = r"c:\\doc" directory = os.fsencode(files_from_folder) amount = 1 word = client.DispatchEx("Word.Application") word.Visible = True for file in os.listdir(directory): filename = os.fsdecode(file) print(filename) if filename.endswith('docx'): text = docx2txt.process(os.path.join(files_from_folder, filename)) print(f'{filename} transfered ({amount})') amount += 1 new_filename = filename.split('.')[0] + '.txt' try: with open(os.path.join(files_from_folder + r'\txt_files', new_filename), 'w', encoding='utf-8') as t: t.write(text) except: os.mkdir(files_from_folder + r'\txt_files') with open(os.path.join(files_from_folder + r'\txt_files', new_filename), 'w', encoding='utf-8') as t: t.write(text) elif filename.endswith('doc'): doc = word.Documents.Open(os.path.join(files_from_folder, filename)) text = doc.Range().Text doc.Close() print(f'{filename} transfered ({amount})') amount += 1 new_filename = filename.split('.')[0] + '.txt' try: with open(os.path.join(files_from_folder + r'\txt_files', new_filename), 'w', encoding='utf-8') as t: t.write(text) except: os.mkdir(files_from_folder + r'\txt_files') with open(os.path.join(files_from_folder + r'\txt_files', new_filename), 'w', encoding='utf-8') as t: t.write(text) word.Quit() That's all folks. Jereo ihany koa ityVersion 2na Version 3naVersion 4naVersion 5naVersion 6naVersion 7 Latest articles accessed by readers:
Donate via Paypal
RECURRENT DONATIONDonate monthly to support SINGLE DONATIONDonate the desired amount to support Donate by Bank TransferAccount Ron: RO34INGB0000999900448439
Open account at ING Bank
|
||||||||||||
![]() |
||||||||||||