List index out of range error, check the list of cross-border errors, but because people could not weak code to check the specific problem, also the crawler great god please help help to solve! Thank you care!
The import OS
The import win32com
The from win32com. Client import Dispatch, constants
The from docx import Document
Def parse_docx (f) :
"" "read docx, return name and industry
"" "
D=Document (f)
T=which ables [0]
T_next=which ables [1]
# title=tc ell (0, 1). The text//such as the title in the table is located in the (0, 1)
Company_name=tc ell (1, 1). The text # 1
Tax_num=tc ell (1, 3). The text # 1
Reg_address=tc ell (2, 1). The text # 1
Tel=tc ell (2, 3). The text # 1
Bank_name=tc ell (3, 1). The text # 1
Bank_Account=tc ell (3, 3). The text # 1
Send_address=tc ell (4, 1). The text # 1
Receiver_tel=tc ell (4, 3). Text# 1
# Other=t_next. Cell (1, 1). The text
Print (Company_name, Tax_num Reg_address, Tel, Bank_name, Bank_Account, Send_Account, Receiver_tel, end='\ n')
"' the above function main implementation file read '"'
If __name__=="__main__" :
W=win32com. Client. Dispatch (' Word. Application)
# traverse the file
PATH="D: \ \ worktest \ " # Windows file PATH
Doc_files=OS. Listdir (PATH)
For doc in doc_files:
If OS. Path. Splitext (doc) [1]=='docx' :
Try:
Parse_docx (PATH + '\ \' + doc)
Except the Exception as e:
Print (e)
To extract the file is in the picture document form inside, want to have more than a similar word file content into a Excel file. Please great god myself!!!!!!
CodePudding user response:
please advise!CodePudding user response:
Error message stick, error message which line is wrongCodePudding user response: