"Brain Stormer" <[EMAIL PROTECTED]> wrote
> Thanks for the file direction method but how do I get the names of
> the files
> so I can use it inside my program.
I'm not sure I understand.
Thepoint of using redirection is that your code doesn't need to know
anything about the files, it just read
Actually, Let me take that back with the raw_input comment since it is not
the idle issue but I didn't want to the program to be interactive so I
didn't want to wait for someone to put the information and press enter.
Thanks for the file direction method but how do I get the names of the files
so I
"Brain Stormer" <[EMAIL PROTECTED]> wrote
>I have a python program which works fine when run using idle but I
>would
> like call the program from the terminal.
>
> python test.py -i inputfile -o outputfile
Easier to use file redirection:
python test.py < inputfile > outputfile
The -i flag in
I used the optparse module since that is exactly what I wanted. Here is my
code:
import sys
from optparse import OptionParser
import os
parser = OptionParser()
parser.add_option("-i", "--input", dest="infile",
help="input FILE to convert", metavar="FILE")
parser.add_option("-o", "--output", dest
On Mon, Apr 14, 2008 at 12:55 PM, Brain Stormer <[EMAIL PROTECTED]> wrote:
> I have a python program which works fine when run using idle but I would
> like call the program from the terminal.
>
> python test.py -i inputfile -o outputfile
>
> I tried with raw_input but that only works in idle. Can
i think you need to try :
cat input.txt | /usr/bin/python test.py >output.txt
>
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
look at the OptParse module, with this u can easily realize such things.
http://docs.python.org/lib/module-optparse.html
On Mon, Apr 14, 2008 at 12:55:07PM -0400, Brain Stormer wrote:
> I have a python program which works fine when run using idle but I would
> like call the program from the termi
I have a python program which works fine when run using idle but I would
like call the program from the terminal.
python test.py -i inputfile -o outputfile
I tried with raw_input but that only works in idle. Can this be achieved?
Thanks
___
Tutor maill