How do I add the output of a simple math equation to my docx doc?
For example
math = 2+2
math
add_paragraph can only do strings and not integers. Is there a work around for this?
p = document.add_paragraph(math)
document.save('doc.docx')
Use casting
math_string = str(math)
p = document.add_paragraph(math_string)
document.save('doc.docx')
将int转换为字符串吗?
p = document.add_paragraph(str(math))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.