How do you write to the printer ?

Scott David Daniels Scott.Daniels at Acm.Org
Wed Jan 7 18:17:19 EST 2009


David Lemper wrote:
> Can find nothing in the on-line docs or a book.
> Groping in the dark I attempted :
> 
> script24
>     import io
>     io.open('stdprn','w')          # accepted
Here's your first mistake:  you need to get the result of that call.
Try:
       stdprn = io.open('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