help for beginner !

Cliff Wells logiplexsoftware at earthlink.net
Wed Nov 14 19:00:49 CET 2001


On Wednesday 14 November 2001 09:08, Michel Bonnifait wrote:
> thanks for your answer. when i say "print' i mean to a printer and "copying
> etc;" i mean exactly what you understood
> "Cliff Wells" <logiplexsoftware at earthlink.net> a écrit dans le message de
> news: mailman.1005678515.14007.python-list at python.org...
>
> > On Tuesday 13 November 2001 06:07, Michel Bonnifait wrote:
> > > i want to directly print  the list or the result of my program
> > > i'm working with idle and i don't know how to do it without copying in
>
> one
>
> > > printable document
> >
> > I'm sorry, I don't know exactly what you are trying to do.  When you say
> > "print", do you mean to the screen or to an actual printer?  By "copying
>
> in
>
> > one printable document" do you mean copying the output of your program
>
> into a
>
> > text editor that you can then print from?
> >
> > Are you running Windows or some variation of Unix/Linux?
> >

You still didn't specify what OS you are using, however:

The following works for me under RedHat Linux 7.1:

import os
lpr = os.popen('/usr/bin/lpr', 'w')
lpr.write("hello, world\n")
lpr.close()

Under Windows, I believe you can just open LPT1: (or whatever port your 
printer is on) and write to it, but I have no way of testing this.



-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308




More information about the Python-list mailing list