Writing to SdtErr

Michael Hudson mwh at python.net
Tue Oct 23 06:28:41 EDT 2001


sburr at home.com (sburrious) writes:

> Michael Hudson <mwh at python.net> wrote in message news:<u8ze36bit.fsf at python.net>...
> > "Mike Peat" <mike at unicorn-fs.com> writes:
> > 
> > > Can anyone tell me how to:
> 
> > > 2) Write (print) to the StdErr channel instead of StdOut?
> > 
> > print >> sys.stderr, "foo"
> 
> Don't let Alex Martelli catch you promoting the use of ">>."  :)

No, I exactly want people to see it to show that it isn't necessarily
horrible :-).

[...]
> sys.stderr.write("Now go away,\n")
[...]
> sys.stdout = sys.stderr
> print "Your father was a hamster,"
> sys.stdout = stdoutholder
[...]

Less horrible than these (in most cases, anyway).

not-prepared-to-argue-on-this-one-so-don't-even-bother-ly y'rs
M.

-- 
  The Oxford Bottled Beer Database heartily disapproves of the 
  excessive consumption of alcohol.  No, really.
                        -- http://www.bottledbeer.co.uk/beergames.html



More information about the Python-list mailing list