蟒蛇&MS Word:将 .doc 转换为 .docx? [英] Python & MS Word: Convert .doc to .docx?

查看:19
本文介绍了蟒蛇&MS Word:将 .doc 转换为 .docx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了几个与我的问题相似的问题,但没有一个答案与我的需要相近.

I found several questions that were similar to mine, but none of the answers came close to what I need.

规格:我使用 Python 3 并且没有 MS Word.我的编程机运行的是 OS X,云机也是 linux/ubuntu.

Specifications: I'm working with Python 3 and do not have MS Word. My programming machine is running OS X and cloud machine is linux/ubuntu too.

我正在使用 python-docx 从每晚发送给我的 .doc 文件中提取值.但是,python-docx 仅适用于 .docx 文件,因此我需要先将文件转换为该扩展名.

I'm using python-docx to extract values from a .doc file that is sent to me nightly. However, python-docx only works with .docx files, so I need to convert the file to that extension first.

所以,我有一个 .doc 文件,我需要将其转换为 .docx.此脚本可能必须在云中运行,因此我无法安装任何类型的 Office 或类似 Office 的软件.可以这样做吗?

So, I've got a .doc file that I need to convert to .docx. This script might have to run in the cloud so I can't install any kind of Office or Office-like software. Can this be done?

推荐答案

您正在使用 Linux/ubuntu,您可以使用 LibreOffice 的内置转换器.

You are working with Linux/ubuntu, you can use LibreOffice’s inbuilt converter.

lowriter --convert-to docx *.doc

示例

lowriter --convert-to docx testdoc.doc

这会将所有 doc 文件转换为 docx 并保存在同一文件夹中.

This will convert all doc files to docx and save in the same folder itself.

这篇关于蟒蛇&MS Word:将 .doc 转换为 .docx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆