Using Python Template Library docxtpl to Batch Create Word Documents

In work, repetitive labor is often tedious. Leveraging the power of Python to optimize workflows can greatly improve efficiency and achieve twice the result with half the effort. This article will detail how to use the Python template library docxtpl to automatically generate multiple Word documents in a very short time, saving a lot of manual operation time, thus freeing up your hands and easily completing tasks.

Python docxtpl batch creation of Word files

Update: It’s a bit difficult for beginners to do it with Python. So I wrote an online tool that supports batch generation of Word documents from templates and data. Online Batch Generate Word Tool Address

Read More

Real Examples Showing How ChatGPT Can Make Things Up!

GPT-4, this outstanding representative of artificial intelligence, has already surpassed ordinary humans in many aspects. My daily life is increasingly dependent on ChatGPT, which has greatly improved my work efficiency. However, during use, I’ve found that ChatGPT still sometimes makes “naive” mistakes, like the occasional mischievous behavior of a growing child.

This article records some erroneous answers discovered during daily use of ChatGPT, like recording embarrassing moments in a child’s growth. When AI “grows up” one day, we can look back on these “childhood” embarrassing moments together.

Collection of ChatGPT's erroneous answers

Read More

Troubleshooting HTTP Request Timeout Issues Caused by HTTP Headers

In actual business, we encountered a very strange problem: when service A accessed Go language service B through HTTP requests, a small portion of the requests would time out. Further analysis revealed that if a request timed out, its retry would definitely time out as well, indicating that for specific request content, the timeout was an inevitable problem. By checking the processing logs of service B, it was found that for timed-out requests, the processing time of the business logic was normal.

Initially, we used the process of elimination to analyze, gradually replacing suspected problematic modules, but we couldn’t locate the problem. Later, through packet capture, we analyzed the differences between normal packets and timeout packets, made reasonable guesses about the problematic parts, and verified them. We finally located that it was the Expect: 100-continue request HTTP header that caused the timeout here. The entire troubleshooting and fixing process encountered many pitfalls, which are recorded here for everyone’s reference.

WireShark packet capture of HTTP expect: 100-continue

Read More