How do you write to the printer ?

Scott David Daniels Scott.Daniels at Acm.Org
Thu Jan 8 00:17:19 CET 2009

David Lemper wrote:
> Can find nothing in the on-line docs or a book.
> Groping in the dark I attempted :
> script24
>     import io
>'stdprn','w')          # accepted
Here's your first mistake:  you need to get the result of that call.
       stdprn ='stdprn', 'w')
>     stdprn.write('hello printer')   # fails  < stdprn is not defined >

Note that (1) You may have just created a file named stdprn.
           (2) You need to close that file bwhen you are done.
           (3) A final end-of-line is traditional.
           (4) You could give us a clue about your operating environment.
               (To wit: os, version, python version)

A printer is nothing Python has or controls, it is  a standard thing for
a computer system, so details about your computing environment are
necessary in order to give you good advice.

--Scott David Daniels
Scott.Daniels at Acm.Org

More information about the Python-list mailing list