Python-docx插入图片报错“NameError: name 'Inches' is not defined”

在使用 Python-docx 库操作Word文档时,需要插入图片,在设置宽高时,报错“NameError: name 'Inches' is not defined”

 

原因是:没有 导入 Inches 模块

 

解决方法:

from docx.shared import Inches

 

posted @ 2021-01-26 22:25  十一的杂文录  阅读(1037)  评论(0编辑  收藏  举报