多谢先,我昨天试了一下,报这个错误,也不知道咋回事,感觉只能放弃linux之下转换
了
raise XLRDError('Unsupported format, or corrupt file: ' + msg)
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF reco
rd; found b'\xc0\xfa\xca\xb7\xd0\xd0\xc7\xe9'
【 在 callmebbser 的大作中提到: 】
: 标 题: Re: 请问linux 如何用python 批量把xls转换为xlsx?
: 发信站: 水木社区 (Sat Nov 12 22:40:06 2022), 转信
:
:
https://infotechmanagefactory.com/convert-xls-xlsx-python/:
: To convert xls to xlsx:
:
: $ pip install pyexcel pyexcel-xls pyexcel-xlsx
:
: Run Python Script as:
:
: import pyexcel as p
:
: p.save_book_as(file_name='your-file-in.xls',
:
: dest_file_name='your-new-file-out.xlsx')
:
: If you do not need a program, you could install one additinal package pyexce
: l-cli::
:
: $ pip install pyexcel-cli
:
: $ pyexcel transcode your-file-in.xls your-new-file-out.xlsx
:
: The transcoding procedure above uses xlrd and openpyxl.
:
: 没安装和试过上述代码,不知在Linux下是否可以正常运行。
:
: 若可以正常运行,那用os.walk()就可以遍历目录和文件把xls文件转换成xlsx文件了。
:
:
:
:
https://pythondex.com/convert-xls-to-xlsx-python:
: pip install xls2xlsx
:
: Code To Convert XLS To XLSX In Python
:
: from xls2xlsx import XLS2XLSX
:
: # Enter the xls file name here
:
: x2x = XLS2XLSX("sample.xls")
:
: # Enter the xlsx file name you want after converting here
:
: x2x.to_xlsx("output.xlsx")
:
:
:
:
: 【 在 futurehost 的大作中提到: 】
: : rt
: : 谢谢先
:
: --
:
: ※ 来源:·水木社区 mysmth.net·[FROM: 119.233.177.*]
--
修改:futurehost FROM 183.165.123.*
FROM 183.165.123.*