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
: 谢谢先
--
FROM 119.233.177.*