Lines.=fopen readlines ()
The file=XLWT. Workbook (encoding="utf-8", style_compression=0)
Sheet=file. Add_sheet (' data ')
I=0
For the line in lines:
The line=line. Strip (' \ n ')
The line=line. The split ()
Company_num=line [0]
The date=line [1]
Baifenbi=line [2]
Sheet. Write (I, 0, company_num)
Sheet. Write (I, 1, date)
Sheet. Write (I, 2, baifenbi)
I=I + 1
The file. Save (excelname)
CodePudding user response:
OS. Renames (" old name ", "new name")Names are file formats with file suffix