任何人都可以帮助我计算docx文件中一行的选项卡数量。我想知道创建层次结构的标签数量,例如一个标签为1),两个标签为1.1),三个标签为1.1.1),等等。
我正在使用Python 3的库python-docx。
from docx import *
document = Document('Sample.docx')
for paragraph in document.paragraphs:
for run in paragraph.runs:
#Count the number of tabs in a line of text
谢谢。