#! 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')