小编Dil*_*lip的帖子

Python:AttributeError:“模块”对象没有属性“ WD_BREAK”

这是我的代码:

import docx

doc = docx.Document()
doc.add_paragraph('This is on first page!')
doc.paragraphs[0].runs[0].add_break(docx.text.WD_BREAK.PAGE)
doc.add_paragraph('This is on the second page!')
doc.save('twoPage.docx')
Run Code Online (Sandbox Code Playgroud)

错误是:

AttributeError: 'module' object has no attribute 'WD_BREAK'
Run Code Online (Sandbox Code Playgroud)

python docx attributeerror

3
推荐指数
1
解决办法
2758
查看次数

标签 统计

attributeerror ×1

docx ×1

python ×1