How to write to printer in Windows?

musingattheruins at musingattheruins at
Wed Apr 19 17:45:33 EDT 2000

> From my DOS days, I seem to recall that 'lpt1:' was the correct name
> for the printer device.  lpt1 may be trying to write to a file in a
> directory for which you don't have permission.

You can save the data that you want to print to a text file (say
text.txt) and then call...

   print text.txt

You can do this with a system call...
   import os
   os.system("print text.txt")

or you can go the long way around and try this module....
import printer
p = printer.Printer()
p.write("this is some test\nand so is this")
del p

You can find it at...

Bill :-)

Sent via
Before you buy.

More information about the Python-list mailing list