pipe command to script
narshe at gmail.com
Mon Sep 20 21:30:37 CEST 2004
Nice, that's easy. I did it some other way last time that worked
also..... probably doing things twice the other way though.
On Mon, 20 Sep 2004 12:24:25 -0700, Robert Kern <rkern at ucsd.edu> wrote:
> Josh Close wrote:
> > How can I read input from stdin pipe from somewhere?
> > ex:
> > # echo hello | script.py
> > I was thinking opening file() or popen() with sys.stdin, but that
> > didn't work. I've done this before but don't have the code anymore and
> > can't figure it out again.
> sys.stdin is already an open file object. Just call sys.stdin.read().
> > Thanks.
> > -Josh
> Robert Kern
> rkern at ucsd.edu
> "In the fields of hell where the grass grows high
> Are the graves of dreams allowed to die."
> -- Richard Harter
More information about the Python-list