Directed input

Steve Holden sholden at holdenweb.com
Tue Oct 16 17:31:19 EDT 2001


"Kragen Sitaker" <kragen at dnaco.net> wrote in message
news:BR0z7.1417$Z2.283368 at e420r-atl2.usenetserver.com...
> In article <9qi4r2$gpq$1 at nserve1.acs.ucalgary.ca>,
> Michael Yuen <myuen at acs2.acs.ucalgary.ca> wrote:
> >I'm just in the process of learning Python right now and i'm wondering if
> >there's a way run a program to take a file via directed input and
> >sending output to another file via the command line.
> >
> >Here's what I mean:
> >
> >myprogram.py < my_input > my_output
>
> I assume you're on Unix?  The above should work fine.

If, however, you are on Windows NT, you will find that a bug in the command
processor (NT's, that is) stops redirection from working on commands where
the executable is deduced from a file extension. Therefore in this
environment you need:

python myprogram.py < my_input > my_output

This is also required on Win95/98 (except cygwin/bash, which is pretty
Unix-like on all Windows flavors).

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list