[Tutor] Printing data to a printer...

Alan Gauld alan.gauld at btinternet.com
Sat Jan 2 23:18:36 CET 2010


"Ken G." <beachkid at insightbb.com> wrote

> Wow, I looked and looked.  I can print out my program listing but can 
> not print the resulted data produced by the program.

Printing is always difficult in a modern OS because your program 
and Python cannot be sure of what kind of device it is going to print on.

Unix traditionally did printing by creating a temporary file with 
markup - usually roff markup - and then  sending that file 
through the text processor (eg [gtn]roff) and hence to the 
print spool for processing by lp or lpr.

You can still do that although nowadays I tend to use HTML as 
the formatting language and print via a browser. For simple text 
output you can of course bypass the formatting step and just 
send it straight to lpr, possibly via fmt.
> In Liberty Basic, the command was lprint.  

In the days of standard BASIC the printer was almost certainly 
an Epson compatible ASCII printer which made it pretty easier 
for the interpreter to send output directly. Those days are long 
gone :-(

Its the same with input - there is no direct equivalent to 
inkey$, although curses comes close, because again we now 
have a huge variety of input devices.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100102/ee4dbd7c/attachment-0001.htm>


More information about the Tutor mailing list