首页 > 解决方案 > 如何在 Python 中将文本打印到打印机而无需在第一页(或每页)上打印文件名?

问题描述

import tempfile
import os 

q=tempfile.mktemp(".txt")
open(q,"w").write("the writing")
os.startfile(q,"print")

运行此代码时,打印机会输出 [“the writing”](没关系),并且在纸的顶部还有一个名为:=“tempsh03uiuc.txt”的文本。帮我解决这个问题,“ tempsh03uiuc.txt ”是无关紧要的事情。

标签: pythonoperating-systemtemporary-files

解决方案


推荐阅读