I hope to use read and write method to merge two word docs into another, but it only can write the content of the f1
word document successfully. Writing the f2
word doc does not work. I tried the following:
# coding=utf-8
f=open('C:\Users\Desktop\word.doc','ab')
f1=open('C:\Users\Desktop\word1.doc','rb')
f2=open('C:\Users\Desktop\word2.doc','rb')
data1=f1.read()
data2=f2.read()
f.write(data1)
f.write(data2)
f1.close()
f2.close()
f.close()