【发布时间】:2019-04-05 03:12:04
【问题描述】:
所以我有这本词典
mydict = {'name': 'Theo', 'age': '39', 'gender': 'male', 'eyecolor': 'brown'}
我使用 docx-mailmerge 将这些数据合并到一个 word 文档中。
template = "myworddoc.docx"
newdoc = "mergeddoc.docx"
document = MailMerge(template)
document.merge(mydict)
document.write(newdoc)
但是创建的文档是空的。我猜它只适用于 kwargs??
我只能使用与 kwargs 的合并吗
document.merge(name='Theo', age='39', gender='male', eyecolor='brown')
我真的很喜欢用字典来合并数据。
我是否将 dict 转换为 kwarg(以及如何执行此操作)还是使用 dict?
感谢您的帮助!
【问题讨论】:
标签: python dictionary ms-word docx-mailmerge