piping into a python script

Paddy paddy3118 at googlemail.com
Thu Jan 24 11:38:31 EST 2008


On Jan 24, 4:02 pm, Donn Ingle <donn.in... at gmail.com> wrote:
> > Try the fileinput module.
>
> I did give the fileinput module a go, but I can't find much info on it and
> the help is ... well, it's python help ;)

Try http://effbot.org/librarybook/fileinput.htm

>
> > in goes to its stdin where it is processed if it has an argument of -
> > fileinput works that way
>
> Okay, I did think of the dash, but did not know how to handle it. Is it a
> bash thing or will that dash get passed into the args? (I am using getopt
> to parse the options and args)

- gets passed in and fileinput handles it.

>
> > which would work for ls and a python program using the fileinput
> > module.
>
> Any examples of fileinput (that do not open each file) would be great!
> (I'll go searching now anyway)
fileinput is set to process each file a line at a time unfortunately.

>
> Thanks,

Your welcome :-)

- Paddy.






More information about the Python-list mailing list