Print to Paper
Daniel <duram at terra.com.br> writes:
> How to do a code to print to paper? please post here a "Hello World"
> code to be printed on paper with an inkjet.
It depends on the Operating System. Python doesn't have a standard, system-independent way to print to paper.
On most Unix-like systems (like my MacOS) the following works:
from subprocess import Popen, PIPE
p = Popen('lpr', stdin=PIPE)
In a production system error checking should be added. Also if a nice layout is desired, you should probably want to generate a PDF file and send that to the printer, possibly with the use of LaTeX.
Piet van Oostrum <piet-l at vanoostrum.org>
PGP key: [8DAE142BE17999C4]