开发者

How do I print to the OS's default printer in Python 3 (cross platform)?

I have a Python 3 script that is going to be doing some regex substitution on some Rich Te开发者_运维技巧xt Files (rtf) and I would like to be able to print out a whole directory's files on Windows, Linux, and Mac.

Is there a way to print to the OS's default printer so that it works in all platforms?


There is no cross-platform way. On Linux and OS X you can invoke lpr(1) via subprocess and CUPS will handle the document conversion as best as possible, but Windows is trickier.


With the OS module you can print files in Windows or higher.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜