Python实现word选择题自动选择答案上

2025-05-28 05:42:47

1、首先需要安装python-docxpip install python-docx如下所示完成python-docx的安装

Python实现word选择题自动选择答案上

3、使用步骤2中定义的函数,进行word文档的操作,strword=readDocx('E:\software\demo.docx')print(strword)这里将把demo.docx这个word文档的文字读取输出

Python实现word选择题自动选择答案上Python实现word选择题自动选择答案上Python实现word选择题自动选择答案上Python实现word选择题自动选择答案上

6、取到位置我们就可以在指定位置传入需要的元素了zjl=[]for i ,val in enumerate(readlist): if val == ')媪青怍牙' or val==')': zjl.append(i)for i in range(len(zjl)): readlist.insert(zjl[i]+i,'A')print(readlist)如下图即可插入A到括号里

Python实现word选择题自动选择答案上
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢