python编程快速上手之第13章实践项目参考答案(13.6.2)
#! python3 # encoding: UTF-8 import os import docx from docx import Document from docx.shared import Pt from docx.shared import Inches os.chdir('C:\\Users\\Administrator\\Python35-32') doc = docx.Document('InvitationLetter.docx') guests = open('guests.txt') doc.add_page_break() font_name = u'Brush Script MT' for n in guests: doc.add_paragraph(doc.paragraphs[0].text) doc.add_paragraph(n) doc.add_paragraph(doc.paragraphs[2].text) doc.add_paragraph(doc.paragraphs[3].text) doc.add_paragraph(doc.paragraphs[4].text) doc.add_page_break() doc.save('InvitationLetter2.docx')
posted on 2017-05-21 00:56 flying-wyf 阅读(209) 评论(0) 编辑 收藏 举报