pipe command to script
Josh Close
narshe at gmail.com
Mon Sep 20 15:30:37 EDT 2004
Nice, that's easy. I did it some other way last time that worked
also..... probably doing things twice the other way though.
Thanks!
-Josh
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
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list