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.
精彩评论